Example usage for org.springframework.web.socket.sockjs.client XhrClientSockJsSession getTimeoutTask

List of usage examples for org.springframework.web.socket.sockjs.client XhrClientSockJsSession getTimeoutTask

Introduction

In this page you can find the example usage for org.springframework.web.socket.sockjs.client XhrClientSockJsSession getTimeoutTask.

Prototype

Runnable getTimeoutTask() 

Source Link

Document

Return a timeout cleanup task to invoke if the SockJS sessions is not fully established within the retransmission timeout period calculated in SockJsRequest based on the duration of the initial SockJS "Info" request.

Usage

From source file:org.springframework.web.socket.sockjs.client.AbstractXhrTransport.java

@Override
public ListenableFuture<WebSocketSession> connect(TransportRequest request, WebSocketHandler handler) {
    SettableListenableFuture<WebSocketSession> connectFuture = new SettableListenableFuture<>();
    XhrClientSockJsSession session = new XhrClientSockJsSession(request, handler, this, connectFuture);
    request.addTimeoutTask(session.getTimeoutTask());

    URI receiveUrl = request.getTransportUrl();
    if (logger.isDebugEnabled()) {
        logger.debug("Starting XHR " + (isXhrStreamingDisabled() ? "Polling" : "Streaming") + "session url="
                + receiveUrl);/*from   www.ja  v  a2  s  . c  om*/
    }

    HttpHeaders handshakeHeaders = new HttpHeaders();
    handshakeHeaders.putAll(request.getHandshakeHeaders());

    connectInternal(request, handler, receiveUrl, handshakeHeaders, session, connectFuture);
    return connectFuture;
}