@Override public void afterConnectionClosed(WebSocketSession webSocketSession, CloseStatus status) throws Exception { this.sockJsSession.afterTransportClosed(status); } }
@Override public void handleTextMessage(WebSocketSession webSocketSession, TextMessage message) throws Exception { this.sockJsSession.handleFrame(message.getPayload()); }
@Override public void handleTransportError(WebSocketSession webSocketSession, Throwable ex) throws Exception { this.sockJsSession.handleTransportError(ex); }
@Override public ListenableFuture<WebSocketSession> connect(TransportRequest request, WebSocketHandler handler) { final SettableListenableFuture<WebSocketSession> future = new SettableListenableFuture<>(); WebSocketClientSockJsSession session = new WebSocketClientSockJsSession(request, handler, future); handler = new ClientSockJsWebSocketHandler(session); request.addTimeoutTask(session.getTimeoutTask()); URI url = request.getTransportUrl(); WebSocketHttpHeaders headers = new WebSocketHttpHeaders(request.getHandshakeHeaders()); if (logger.isDebugEnabled()) { logger.debug("Starting WebSocket session on " + url); } this.webSocketClient.doHandshake(handler, headers, url).addCallback( new ListenableFutureCallback<WebSocketSession>() { @Override public void onSuccess(@Nullable WebSocketSession webSocketSession) { // WebSocket session ready, SockJS Session not yet } @Override public void onFailure(Throwable ex) { future.setException(ex); } }); return future; }
@Override public void afterConnectionEstablished(WebSocketSession webSocketSession) throws Exception { Assert.state(this.connected.compareAndSet(false, true), "Already connected"); this.sockJsSession.initializeDelegateSession(webSocketSession); }
@Override public ListenableFuture<WebSocketSession> connect(TransportRequest request, WebSocketHandler handler) { final SettableListenableFuture<WebSocketSession> future = new SettableListenableFuture<>(); WebSocketClientSockJsSession session = new WebSocketClientSockJsSession(request, handler, future); handler = new ClientSockJsWebSocketHandler(session); request.addTimeoutTask(session.getTimeoutTask()); URI url = request.getTransportUrl(); WebSocketHttpHeaders headers = new WebSocketHttpHeaders(request.getHandshakeHeaders()); if (logger.isDebugEnabled()) { logger.debug("Starting WebSocket session on " + url); } this.webSocketClient.doHandshake(handler, headers, url).addCallback( new ListenableFutureCallback<WebSocketSession>() { @Override public void onSuccess(@Nullable WebSocketSession webSocketSession) { // WebSocket session ready, SockJS Session not yet } @Override public void onFailure(Throwable ex) { future.setException(ex); } }); return future; }
@Override public void afterConnectionEstablished(WebSocketSession webSocketSession) throws Exception { Assert.state(this.connected.compareAndSet(false, true), "Already connected"); this.sockJsSession.initializeDelegateSession(webSocketSession); }
@Override public ListenableFuture<WebSocketSession> connect(TransportRequest request, WebSocketHandler handler) { final SettableListenableFuture<WebSocketSession> future = new SettableListenableFuture<>(); WebSocketClientSockJsSession session = new WebSocketClientSockJsSession(request, handler, future); handler = new ClientSockJsWebSocketHandler(session); request.addTimeoutTask(session.getTimeoutTask()); URI url = request.getTransportUrl(); WebSocketHttpHeaders headers = new WebSocketHttpHeaders(request.getHandshakeHeaders()); if (logger.isDebugEnabled()) { logger.debug("Starting WebSocket session on " + url); } this.webSocketClient.doHandshake(handler, headers, url).addCallback( new ListenableFutureCallback<WebSocketSession>() { @Override public void onSuccess(@Nullable WebSocketSession webSocketSession) { // WebSocket session ready, SockJS Session not yet } @Override public void onFailure(Throwable ex) { future.setException(ex); } }); return future; }
@Override public void afterConnectionClosed(WebSocketSession webSocketSession, CloseStatus status) throws Exception { this.sockJsSession.afterTransportClosed(status); } }
@Override public void afterConnectionEstablished(WebSocketSession webSocketSession) throws Exception { Assert.state(this.connected.compareAndSet(false, true), "Already connected"); this.sockJsSession.initializeDelegateSession(webSocketSession); }
@Override public void handleTextMessage(WebSocketSession webSocketSession, TextMessage message) throws Exception { this.sockJsSession.handleFrame(message.getPayload()); }
@Override public void handleTransportError(WebSocketSession webSocketSession, Throwable ex) throws Exception { this.sockJsSession.handleTransportError(ex); }
@Override public void afterConnectionClosed(WebSocketSession webSocketSession, CloseStatus status) throws Exception { this.sockJsSession.afterTransportClosed(status); } }
@Override public void handleTextMessage(WebSocketSession webSocketSession, TextMessage message) throws Exception { this.sockJsSession.handleFrame(message.getPayload()); }
@Override public void handleTransportError(WebSocketSession webSocketSession, Throwable ex) throws Exception { this.sockJsSession.handleTransportError(ex); }