Class WebSocketClientSockJsSession
java.lang.Object
org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession
org.springframework.web.socket.sockjs.client.WebSocketClientSockJsSession
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- NativeWebSocketSession,- WebSocketSession
public class WebSocketClientSockJsSession
extends AbstractClientSockJsSession
implements NativeWebSocketSession
An extension of 
AbstractClientSockJsSession wrapping and delegating
 to an actual WebSocket session.- Since:
- 4.1
- Author:
- Rossen Stoyanchev
- 
Field SummaryFields inherited from class org.springframework.web.socket.sockjs.client.AbstractClientSockJsSessionlogger
- 
Constructor SummaryConstructorsConstructorDescriptionWebSocketClientSockJsSession(TransportRequest request, WebSocketHandler handler, CompletableFuture<WebSocketSession> connectFuture) WebSocketClientSockJsSession(TransportRequest request, WebSocketHandler handler, 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 underlying native WebSocketSession.<T> TgetNativeSession(Class<T> requiredType) Return the underlying native WebSocketSession, if available.Return the address of the remote client.intGet the configured maximum size for an incoming text message.voidprotected voidsendInternal(TextMessage textMessage) 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, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.web.socket.WebSocketSessionclose, close, getAttributes, getHandshakeHeaders, getId, getPrincipal, getUri, isOpen, sendMessage
- 
Constructor Details- 
WebSocketClientSockJsSession@Deprecated(since="6.0", forRemoval=true) public WebSocketClientSockJsSession(TransportRequest request, WebSocketHandler handler, SettableListenableFuture<WebSocketSession> connectFuture) Deprecated, for removal: This API element is subject to removal in a future version.as of 6.0, in favor ofWebSocketClientSockJsSession(TransportRequest, WebSocketHandler, CompletableFuture)Create a newWebSocketClientSockJsSession.
- 
WebSocketClientSockJsSessionpublic WebSocketClientSockJsSession(TransportRequest request, WebSocketHandler handler, CompletableFuture<WebSocketSession> connectFuture) 
 
- 
- 
Method Details- 
getNativeSessionDescription copied from interface:NativeWebSocketSessionReturn the underlying native WebSocketSession.- Specified by:
- getNativeSessionin interface- NativeWebSocketSession
 
- 
getNativeSessionDescription copied from interface:NativeWebSocketSessionReturn the underlying native WebSocketSession, if available.- Specified by:
- getNativeSessionin interface- NativeWebSocketSession
- Parameters:
- requiredType- the required type of the session
- Returns:
- the native session of the required type,
 or nullif not available
 
- 
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.- Specified by:
- getLocalAddressin interface- WebSocketSession
 
- 
getRemoteAddressDescription copied from interface:WebSocketSessionReturn the address of the remote client.- Specified by:
- getRemoteAddressin interface- WebSocketSession
 
- 
getAcceptedProtocolDescription copied from interface:WebSocketSessionReturn the negotiated sub-protocol.- Specified by:
- getAcceptedProtocolin interface- WebSocketSession
- 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.- Specified by:
- setTextMessageSizeLimitin interface- WebSocketSession
 
- 
getTextMessageSizeLimitpublic int getTextMessageSizeLimit()Description copied from interface:WebSocketSessionGet the configured maximum size for an incoming text message.- Specified by:
- getTextMessageSizeLimitin interface- WebSocketSession
 
- 
setBinaryMessageSizeLimitpublic void setBinaryMessageSizeLimit(int messageSizeLimit) Description copied from interface:WebSocketSessionConfigure the maximum size for an incoming binary message.- Specified by:
- setBinaryMessageSizeLimitin interface- WebSocketSession
 
- 
getBinaryMessageSizeLimitpublic int getBinaryMessageSizeLimit()Description copied from interface:WebSocketSessionGet the configured maximum size for an incoming binary message.- Specified by:
- getBinaryMessageSizeLimitin interface- WebSocketSession
 
- 
getExtensionsDescription copied from interface:WebSocketSessionDetermine the negotiated extensions.- Specified by:
- getExtensionsin interface- WebSocketSession
- Returns:
- the list of extensions, or an empty list if no extension was specified or negotiated successfully
 
- 
initializeDelegateSession
- 
sendInternal- Specified by:
- sendInternalin class- AbstractClientSockJsSession
- Throws:
- IOException
 
- 
disconnect- Specified by:
- disconnectin class- AbstractClientSockJsSession
- Throws:
- IOException
 
 
- 
WebSocketClientSockJsSession(TransportRequest, WebSocketHandler, CompletableFuture)