Search in sources :

Example 1 with WatcherWebsocket

use of org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.listener.WatcherWebsocket in project zeppelin by apache.

the class ZeppelinClient method openWatcherSession.

private Session openWatcherSession() {
    ClientUpgradeRequest request = new ClientUpgradeRequest();
    request.setHeader(WatcherSecurityKey.HTTP_HEADER, WatcherSecurityKey.getKey());
    WatcherWebsocket socket = WatcherWebsocket.createInstace();
    Future<Session> future = null;
    Session session = null;
    try {
        future = wsClient.connect(socket, zeppelinWebsocketUrl, request);
        session = future.get();
    } catch (IOException | InterruptedException | ExecutionException e) {
        LOG.error("Couldn't establish websocket connection to Zeppelin ", e);
        return session;
    }
    return session;
}
Also used : WatcherWebsocket(org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.listener.WatcherWebsocket) ClientUpgradeRequest(org.eclipse.jetty.websocket.client.ClientUpgradeRequest) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) Session(org.eclipse.jetty.websocket.api.Session)

Aggregations

IOException (java.io.IOException)1 ExecutionException (java.util.concurrent.ExecutionException)1 WatcherWebsocket (org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.listener.WatcherWebsocket)1 Session (org.eclipse.jetty.websocket.api.Session)1 ClientUpgradeRequest (org.eclipse.jetty.websocket.client.ClientUpgradeRequest)1