Class StandardWebSocketSession

java.lang.Object
org.springframework.web.socket.adapter.AbstractWebSocketSession<jakarta.websocket.Session>
org.springframework.web.socket.adapter.standard.StandardWebSocketSession
All Implemented Interfaces:
Closeable, AutoCloseable, NativeWebSocketSession, WebSocketSession

public class StandardWebSocketSession extends AbstractWebSocketSession<jakarta.websocket.Session>
A WebSocketSession for use with the standard WebSocket for Java API.
Since:
4.0
Author:
Rossen Stoyanchev
  • Constructor Details

    • StandardWebSocketSession

      public StandardWebSocketSession(@nullable HttpHeaders headers, @nullable Map<String,Object> attributes, @nullable InetSocketAddress localAddress, @nullable InetSocketAddress remoteAddress)
      Constructor for a standard WebSocket session.
      Parameters:
      headers - the headers of the handshake request
      attributes - the attributes from the HTTP handshake to associate with the WebSocket session; the provided attributes are copied, the original map is not used.
      localAddress - the address on which the request was received
      remoteAddress - the address of the remote client
    • StandardWebSocketSession

      public StandardWebSocketSession(@nullable HttpHeaders headers, @nullable Map<String,Object> attributes, @nullable InetSocketAddress localAddress, @nullable InetSocketAddress remoteAddress, @nullable Principal user)
      Constructor that associates a user with the WebSocket session.
      Parameters:
      headers - the headers of the handshake request
      attributes - the attributes from the HTTP handshake to associate with the WebSocket session
      localAddress - the address on which the request was received
      remoteAddress - the address of the remote client
      user - the user associated with the session; if null we'll fall back on the user available in the underlying WebSocket session
  • Method Details