mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
add watcher principal
This commit is contained in:
parent
4616a33414
commit
37e4a9f11f
1 changed files with 6 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ import org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.ZeppelinClient;
|
|||
import org.apache.zeppelin.notebook.socket.Message;
|
||||
import org.apache.zeppelin.notebook.socket.Message.OP;
|
||||
import org.apache.zeppelin.notebook.socket.WatcherMessage;
|
||||
import org.apache.zeppelin.ticket.TicketContainer;
|
||||
import org.eclipse.jetty.websocket.api.Session;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketListener;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -35,6 +36,7 @@ import com.google.gson.Gson;
|
|||
public class WatcherWebsocket implements WebSocketListener {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ZeppelinWebsocket.class);
|
||||
private static final Gson GSON = new Gson();
|
||||
private static final String watcherPrincipal = "watcher";
|
||||
public Session connection;
|
||||
|
||||
public static WatcherWebsocket createInstace() {
|
||||
|
|
@ -54,7 +56,10 @@ public class WatcherWebsocket implements WebSocketListener {
|
|||
public void onWebSocketConnect(Session session) {
|
||||
LOG.info("WatcherWebsocket connection opened");
|
||||
this.connection = session;
|
||||
session.getRemote().sendStringByFuture(GSON.toJson(new Message(OP.WATCHER)));
|
||||
Message watcherMsg = new Message(OP.WATCHER);
|
||||
watcherMsg.principal = watcherPrincipal;
|
||||
watcherMsg.ticket = TicketContainer.instance.getTicket(watcherPrincipal);
|
||||
session.getRemote().sendStringByFuture(GSON.toJson(watcherMsg));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue