Top Description Fields Constructors Methods
org.springframework.web.socket.sockjs.client

public Class WebSocketClientSockJsSession

extends AbstractClientSockJsSession
implements NativeWebSocketSession
Class Inheritance
All Implemented Interfaces
org.springframework.web.socket.adapter.NativeWebSocketSession, org.springframework.web.socket.WebSocketSession, java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.IOException, java.net.InetSocketAddress, java.util.List, java.util.concurrent.CompletableFuture, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.socket.CloseStatus, .TextMessage, .WebSocketExtension, .WebSocketHandler, .WebSocketSession, org.springframework.web.socket.adapter.NativeWebSocketSession

An extension of AbstractClientSockJsSession wrapping and delegating to an actual WebSocket session.
Author
Rossen Stoyanchev
Since
4.1

Field Summary

Modifier and TypeField and Description
private WebSocketSession
Inherited from org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession:
logger

Constructor Summary

AccessConstructor and Description
public
WebSocketClientSockJsSession(TransportRequest request, WebSocketHandler handler, SettableListenableFuture<WebSocketSession> connectFuture)

Create a new WebSocketClientSockJsSession.

public

Method Summary

Modifier and TypeMethod and Description
protected void
public String
public int
getBinaryMessageSizeLimit()

Implements org.springframework.web.socket.WebSocketSession.getBinaryMessageSizeLimit.

Get the configured maximum size for an incoming binary message.

public List<WebSocketExtension>
getExtensions()

Implements org.springframework.web.socket.WebSocketSession.getExtensions.

Determine the negotiated extensions.

public InetSocketAddress
getLocalAddress()

Implements org.springframework.web.socket.WebSocketSession.getLocalAddress.

Return the address on which the request was received.

public Object
public <T> T
getNativeSession(Class<T>
the required type of the session
requiredType
)

Implements org.springframework.web.socket.adapter.NativeWebSocketSession.getNativeSession.

Return the underlying native WebSocketSession, if available.

public InetSocketAddress
getRemoteAddress()

Implements org.springframework.web.socket.WebSocketSession.getRemoteAddress.

Return the address of the remote client.

public int
getTextMessageSizeLimit()

Implements org.springframework.web.socket.WebSocketSession.getTextMessageSizeLimit.

Get the configured maximum size for an incoming text message.

public void
protected void
public void
setBinaryMessageSizeLimit(int messageSizeLimit)

Implements org.springframework.web.socket.WebSocketSession.setBinaryMessageSizeLimit.

Configure the maximum size for an incoming binary message.

public void
setTextMessageSizeLimit(int messageSizeLimit)

Implements org.springframework.web.socket.WebSocketSession.setTextMessageSizeLimit.

Configure the maximum size for an incoming text message.

Inherited from org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession:
afterTransportClosedcloseclosecloseInternalgetAttributesgetHandshakeHeadersgetIdgetMessageCodecgetPrincipalgetTimeoutTaskgetUrigetWebSocketHandlerhandleFramehandleTransportErrorisDisconnectedisOpensendMessagetoString

Field Detail

webSocketSessionback to summary
private WebSocketSession webSocketSession
Annotations
@Nullable

Constructor Detail

WebSocketClientSockJsSessionback to summary
public WebSocketClientSockJsSession(TransportRequest request, WebSocketHandler handler, SettableListenableFuture<WebSocketSession> connectFuture)

Create a new WebSocketClientSockJsSession.

Annotations
@Deprecated
since:6.0
WebSocketClientSockJsSessionback to summary
public WebSocketClientSockJsSession(TransportRequest request, WebSocketHandler handler, CompletableFuture<WebSocketSession> connectFuture)

Method Detail

disconnectback to summary
protected void disconnect(CloseStatus status) throws IOException

Implements abstract org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession.disconnect.

Annotations
@Override
getAcceptedProtocolback to summary
public String getAcceptedProtocol()

Implements org.springframework.web.socket.WebSocketSession.getAcceptedProtocol.

Doc from org.springframework.web.socket.WebSocketSession.getAcceptedProtocol.

Return the negotiated sub-protocol.

Returns:String

the protocol identifier, or null if no protocol was specified or negotiated successfully

Annotations
@Override
getBinaryMessageSizeLimitback to summary
public int getBinaryMessageSizeLimit()

Implements org.springframework.web.socket.WebSocketSession.getBinaryMessageSizeLimit.

Doc from org.springframework.web.socket.WebSocketSession.getBinaryMessageSizeLimit.

Get the configured maximum size for an incoming binary message.

Annotations
@Override
getExtensionsback to summary
public List<WebSocketExtension> getExtensions()

Implements org.springframework.web.socket.WebSocketSession.getExtensions.

Doc from org.springframework.web.socket.WebSocketSession.getExtensions.

Determine the negotiated extensions.

Returns:List<WebSocketExtension>

the list of extensions, or an empty list if no extension was specified or negotiated successfully

Annotations
@Override
getLocalAddressback to summary
public InetSocketAddress getLocalAddress()

Implements org.springframework.web.socket.WebSocketSession.getLocalAddress.

Doc from org.springframework.web.socket.WebSocketSession.getLocalAddress.

Return the address on which the request was received.

Annotations
@Override
getNativeSessionback to summary
public Object getNativeSession()

Implements org.springframework.web.socket.adapter.NativeWebSocketSession.getNativeSession.

Doc from org.springframework.web.socket.adapter.NativeWebSocketSession.getNativeSession.

Return the underlying native WebSocketSession.

Annotations
@Override
getNativeSessionback to summary
public <T> T getNativeSession(Class<T> requiredType)

Implements org.springframework.web.socket.adapter.NativeWebSocketSession.getNativeSession.

Doc from org.springframework.web.socket.adapter.NativeWebSocketSession.getNativeSession.

Return the underlying native WebSocketSession, if available.

Parameters
requiredType:Class<T>

the required type of the session

Returns:T

the native session of the required type, or null if not available

Annotations
@SuppressWarnings:unchecked
@Override
@Nullable
getRemoteAddressback to summary
public InetSocketAddress getRemoteAddress()

Implements org.springframework.web.socket.WebSocketSession.getRemoteAddress.

Doc from org.springframework.web.socket.WebSocketSession.getRemoteAddress.

Return the address of the remote client.

Annotations
@Override
getTextMessageSizeLimitback to summary
public int getTextMessageSizeLimit()

Implements org.springframework.web.socket.WebSocketSession.getTextMessageSizeLimit.

Doc from org.springframework.web.socket.WebSocketSession.getTextMessageSizeLimit.

Get the configured maximum size for an incoming text message.

Annotations
@Override
initializeDelegateSessionback to summary
public void initializeDelegateSession(WebSocketSession session)
sendInternalback to summary
protected void sendInternal(TextMessage textMessage) throws IOException

Implements abstract org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession.sendInternal.

Annotations
@Override
setBinaryMessageSizeLimitback to summary
public void setBinaryMessageSizeLimit(int messageSizeLimit)

Implements org.springframework.web.socket.WebSocketSession.setBinaryMessageSizeLimit.

Doc from org.springframework.web.socket.WebSocketSession.setBinaryMessageSizeLimit.

Configure the maximum size for an incoming binary message.

Annotations
@Override
setTextMessageSizeLimitback to summary
public void setTextMessageSizeLimit(int messageSizeLimit)

Implements org.springframework.web.socket.WebSocketSession.setTextMessageSizeLimit.

Doc from org.springframework.web.socket.WebSocketSession.setTextMessageSizeLimit.

Configure the maximum size for an incoming text message.

Annotations
@Override