Class XhrClientSockJsSession
java.lang.Object
org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession
org.springframework.web.socket.sockjs.client.XhrClientSockJsSession
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- WebSocketSession
An extension of 
AbstractClientSockJsSession for use with HTTP
 transports simulating a WebSocket session.- Since:
- 4.1
- Author:
- Rossen Stoyanchev
- 
Field SummaryFields inherited from class org.springframework.web.socket.sockjs.client.AbstractClientSockJsSessionlogger
- 
Constructor SummaryConstructorsConstructorDescriptionXhrClientSockJsSession(TransportRequest request, WebSocketHandler handler, XhrTransport transport, CompletableFuture<WebSocketSession> connectFuture) Create a newXhrClientSockJsSession.XhrClientSockJsSession(TransportRequest request, WebSocketHandler handler, XhrTransport transport, SettableListenableFuture<WebSocketSession> connectFuture) Deprecated, for removal: This API element is subject to removal in a future version.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voiddisconnect(CloseStatus status) Return the negotiated sub-protocol.intGet the configured maximum size for an incoming binary message.Determine the negotiated extensions.Return the address on which the request was received.Return the address of the remote client.intGet the configured maximum size for an incoming text message.protected voidsendInternal(TextMessage message) voidsetBinaryMessageSizeLimit(int messageSizeLimit) Configure the maximum size for an incoming binary message.voidsetTextMessageSizeLimit(int messageSizeLimit) Configure the maximum size for an incoming text message.Methods inherited from class org.springframework.web.socket.sockjs.client.AbstractClientSockJsSessionafterTransportClosed, close, close, closeInternal, getAttributes, getHandshakeHeaders, getId, getMessageCodec, getPrincipal, getUri, getWebSocketHandler, handleFrame, handleTransportError, isDisconnected, isOpen, sendMessage, toString
- 
Constructor Details- 
XhrClientSockJsSession@Deprecated(since="6.0", forRemoval=true) public XhrClientSockJsSession(TransportRequest request, WebSocketHandler handler, XhrTransport transport, SettableListenableFuture<WebSocketSession> connectFuture) Deprecated, for removal: This API element is subject to removal in a future version.as of 6.0, in favor ofXhrClientSockJsSession(TransportRequest, WebSocketHandler, XhrTransport, CompletableFuture)Create a newXhrClientSockJsSession.
- 
XhrClientSockJsSessionpublic XhrClientSockJsSession(TransportRequest request, WebSocketHandler handler, XhrTransport transport, CompletableFuture<WebSocketSession> connectFuture) Create a newXhrClientSockJsSession.- Since:
- 6.0
 
 
- 
- 
Method Details- 
getHeaders
- 
getLocalAddressDescription copied from interface:WebSocketSessionReturn the address on which the request was received.Note: The localAddress is not always possible to access, which is the case with the Standard WebSocket client. In 6.2.x StandardWebSocketClientreturns an address based on the local host and the port of the target address (not the same as the local port). In 7.0, the same will returnnullinstead.
- 
getRemoteAddressDescription copied from interface:WebSocketSessionReturn the address of the remote client.
- 
getAcceptedProtocolDescription copied from interface:WebSocketSessionReturn the negotiated sub-protocol.- Returns:
- the protocol identifier, or nullif no protocol was specified or negotiated successfully
 
- 
setTextMessageSizeLimitpublic void setTextMessageSizeLimit(int messageSizeLimit) Description copied from interface:WebSocketSessionConfigure the maximum size for an incoming text message.
- 
getTextMessageSizeLimitpublic int getTextMessageSizeLimit()Description copied from interface:WebSocketSessionGet the configured maximum size for an incoming text message.
- 
setBinaryMessageSizeLimitpublic void setBinaryMessageSizeLimit(int messageSizeLimit) Description copied from interface:WebSocketSessionConfigure the maximum size for an incoming binary message.
- 
getBinaryMessageSizeLimitpublic int getBinaryMessageSizeLimit()Description copied from interface:WebSocketSessionGet the configured maximum size for an incoming binary message.
- 
getExtensionsDescription copied from interface:WebSocketSessionDetermine the negotiated extensions.- Returns:
- the list of extensions, or an empty list if no extension was specified or negotiated successfully
 
- 
sendInternal- Specified by:
- sendInternalin class- AbstractClientSockJsSession
 
- 
disconnect- Specified by:
- disconnectin class- AbstractClientSockJsSession
 
 
- 
XhrClientSockJsSession(TransportRequest, WebSocketHandler, XhrTransport, CompletableFuture)