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
public class XhrClientSockJsSession extends AbstractClientSockJsSession
An extension ofAbstractClientSockJsSession
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
Constructors Constructor Description XhrClientSockJsSession(TransportRequest request, WebSocketHandler handler, XhrTransport transport, SettableListenableFuture<WebSocketSession> connectFuture)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
disconnect(CloseStatus status)
String
getAcceptedProtocol()
Return the negotiated sub-protocol.int
getBinaryMessageSizeLimit()
Get the configured maximum size for an incoming binary message.List<WebSocketExtension>
getExtensions()
Determine the negotiated extensions.HttpHeaders
getHeaders()
InetSocketAddress
getLocalAddress()
Return the address on which the request was received.InetSocketAddress
getRemoteAddress()
Return the address of the remote client.int
getTextMessageSizeLimit()
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 Detail
XhrClientSockJsSession
public XhrClientSockJsSession(TransportRequest request, WebSocketHandler handler, XhrTransport transport, SettableListenableFuture<WebSocketSession> connectFuture)
Method Detail
getHeaders
public HttpHeaders getHeaders()
getLocalAddress
public InetSocketAddress getLocalAddress()
Description copied from interface:WebSocketSession
Return the address on which the request was received.
getRemoteAddress
public InetSocketAddress getRemoteAddress()
Description copied from interface:WebSocketSession
Return the address of the remote client.
getAcceptedProtocol
public String 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
public List<WebSocketExtension> 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
protected void sendInternal(TextMessage message)
- Specified by:
sendInternal
in classAbstractClientSockJsSession
disconnect
protected void disconnect(CloseStatus status)
- Specified by:
disconnect
in classAbstractClientSockJsSession