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 of AbstractClientSockJsSession for use with HTTP transports simulating a WebSocket session.
Since:
4.1
Author:
Rossen Stoyanchev
  • Constructor Details

  • Method Details

    • getHeaders

      public org.springframework.http.HttpHeaders getHeaders()
    • getLocalAddress

      @Nullable public InetSocketAddress getLocalAddress()
      Description copied from interface: WebSocketSession
      Return the address on which the request was received.

      Note: The localAddress is not always possible to access, which is the case with the Standard WebSocket client. In 6.2.x StandardWebSocketClient returns an address based on the local host and the port of the target address (not the same as the local port). In 7.0, the same will return null instead.

    • getRemoteAddress

      @Nullable public InetSocketAddress getRemoteAddress()
      Description copied from interface: WebSocketSession
      Return the address of the remote client.
    • getAcceptedProtocol

      @Nullable 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 class AbstractClientSockJsSession
    • disconnect

      protected void disconnect(CloseStatus status)
      Specified by:
      disconnect in class AbstractClientSockJsSession