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 Summary
Fields inherited from class org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession
logger
-
Constructor Summary
ConstructorDescriptionXhrClientSockJsSession
(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 Summary
Modifier and TypeMethodDescriptionprotected void
disconnect
(CloseStatus status) Return the negotiated sub-protocol.int
Get 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.int
Get the configured maximum size for an incoming text message.protected void
sendInternal
(TextMessage message) void
setBinaryMessageSizeLimit
(int messageSizeLimit) Configure the maximum size for an incoming binary message.void
setTextMessageSizeLimit
(int messageSizeLimit) Configure the maximum size for an incoming text message.Methods inherited from class org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession
afterTransportClosed, 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
. -
XhrClientSockJsSession
public XhrClientSockJsSession(TransportRequest request, WebSocketHandler handler, XhrTransport transport, CompletableFuture<WebSocketSession> connectFuture) Create a newXhrClientSockJsSession
.- Since:
- 6.0
-
-
Method Details
-
getHeaders
-
getLocalAddress
Description copied from interface:WebSocketSession
Return the address on which the request was received. -
getRemoteAddress
Description copied from interface:WebSocketSession
Return the address of the remote client. -
getAcceptedProtocol
Description copied from interface:WebSocketSession
Return the negotiated sub-protocol.- Returns:
- the protocol identifier, or
null
if no protocol was specified or negotiated successfully
-
setTextMessageSizeLimit
public void setTextMessageSizeLimit(int messageSizeLimit) Description copied from interface:WebSocketSession
Configure the maximum size for an incoming text message. -
getTextMessageSizeLimit
public int getTextMessageSizeLimit()Description copied from interface:WebSocketSession
Get the configured maximum size for an incoming text message. -
setBinaryMessageSizeLimit
public void setBinaryMessageSizeLimit(int messageSizeLimit) Description copied from interface:WebSocketSession
Configure the maximum size for an incoming binary message. -
getBinaryMessageSizeLimit
public int getBinaryMessageSizeLimit()Description copied from interface:WebSocketSession
Get the configured maximum size for an incoming binary message. -
getExtensions
Description copied from interface:WebSocketSession
Determine the negotiated extensions.- Returns:
- the list of extensions, or an empty list if no extension was specified or negotiated successfully
-
sendInternal
- Specified by:
sendInternal
in classAbstractClientSockJsSession
-
disconnect
- Specified by:
disconnect
in classAbstractClientSockJsSession
-
XhrClientSockJsSession(TransportRequest, WebSocketHandler, XhrTransport, CompletableFuture)