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 ofAbstractClientSockJsSessionfor 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 voiddisconnect(CloseStatus status)StringgetAcceptedProtocol()Return the negotiated sub-protocol.intgetBinaryMessageSizeLimit()Get the configured maximum size for an incoming binary message.List<WebSocketExtension>getExtensions()Determine the negotiated extensions.HttpHeadersgetHeaders()InetSocketAddressgetLocalAddress()Return the address on which the request was received.InetSocketAddressgetRemoteAddress()Return the address of the remote client.intgetTextMessageSizeLimit()Get 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.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:WebSocketSessionReturn the address on which the request was received.
getRemoteAddress
public InetSocketAddress getRemoteAddress()
Description copied from interface:WebSocketSessionReturn the address of the remote client.
getAcceptedProtocol
public String getAcceptedProtocol()
Description copied from interface:WebSocketSessionReturn the negotiated sub-protocol.- Returns:
- the protocol identifier, or
nullif no protocol was specified or negotiated successfully
setTextMessageSizeLimit
public void setTextMessageSizeLimit(int messageSizeLimit)
Description copied from interface:WebSocketSessionConfigure the maximum size for an incoming text message.
getTextMessageSizeLimit
public int getTextMessageSizeLimit()
Description copied from interface:WebSocketSessionGet the configured maximum size for an incoming text message.
setBinaryMessageSizeLimit
public void setBinaryMessageSizeLimit(int messageSizeLimit)
Description copied from interface:WebSocketSessionConfigure the maximum size for an incoming binary message.
getBinaryMessageSizeLimit
public int getBinaryMessageSizeLimit()
Description copied from interface:WebSocketSessionGet the configured maximum size for an incoming binary message.
getExtensions
public List<WebSocketExtension> getExtensions()
Description 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
protected void sendInternal(TextMessage message)
- Specified by:
sendInternalin classAbstractClientSockJsSession
disconnect
protected void disconnect(CloseStatus status)
- Specified by:
disconnectin classAbstractClientSockJsSession