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

public Class XhrClientSockJsSession

extends AbstractClientSockJsSession
Class Inheritance
Imports
java.net.InetSocketAddress, .URI, java.util.Collections, .List, java.util.concurrent.CompletableFuture, org.springframework.http.HttpHeaders, .MediaType, org.springframework.util.Assert, org.springframework.web.socket.CloseStatus, .TextMessage, .WebSocketExtension, .WebSocketHandler, .WebSocketSession, org.springframework.web.socket.sockjs.transport.TransportType

An extension of AbstractClientSockJsSession for use with HTTP transports simulating a WebSocket session.
Author
Rossen Stoyanchev
Since
4.1

Field Summary

Modifier and TypeField and Description
private int
private final HttpHeaders
private final HttpHeaders
private final URI
private int
private final XhrTransport
Inherited from org.springframework.web.socket.sockjs.client.AbstractClientSockJsSession:
logger

Constructor Summary

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

Create a new XhrClientSockJsSession.

public
XhrClientSockJsSession(TransportRequest request, WebSocketHandler handler, XhrTransport transport, CompletableFuture<WebSocketSession> connectFuture)

Create a new XhrClientSockJsSession.

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 HttpHeaders
public InetSocketAddress
getLocalAddress()

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

Return the address on which the request was received.

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.

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

binaryMessageSizeLimitback to summary
private int binaryMessageSizeLimit
headersback to summary
private final HttpHeaders headers
sendHeadersback to summary
private final HttpHeaders sendHeaders
sendUrlback to summary
private final URI sendUrl
textMessageSizeLimitback to summary
private int textMessageSizeLimit
transportback to summary
private final XhrTransport transport

Constructor Detail

XhrClientSockJsSessionback to summary
public XhrClientSockJsSession(TransportRequest request, WebSocketHandler handler, XhrTransport transport, SettableListenableFuture<WebSocketSession> connectFuture)

Create a new XhrClientSockJsSession.

Annotations
@Deprecated
since:6.0
XhrClientSockJsSessionback to summary
public XhrClientSockJsSession(TransportRequest request, WebSocketHandler handler, XhrTransport transport, CompletableFuture<WebSocketSession> connectFuture)

Create a new XhrClientSockJsSession.

Since
6.0

Method Detail

disconnectback to summary
protected void disconnect(CloseStatus status)

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
getHeadersback to summary
public HttpHeaders getHeaders()
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
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
sendInternalback to summary
protected void sendInternal(TextMessage message)

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