Class AbstractSockJsSession

java.lang.Object
org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession
All Implemented Interfaces:
Closeable, AutoCloseable, SockJsSession, WebSocketSession
Direct Known Subclasses:
AbstractHttpSockJsSession, WebSocketServerSockJsSession

public abstract class AbstractSockJsSession extends Object implements SockJsSession
An abstract base class for SockJS sessions implementing SockJsSession.
Since:
4.0
Author:
Rossen Stoyanchev, Sam Brannen
  • Field Details

    • DISCONNECTED_CLIENT_LOG_CATEGORY

      public static final String DISCONNECTED_CLIENT_LOG_CATEGORY
      Log category to use on network IO exceptions after a client has gone away.

      Servlet containers don't expose a client disconnected callback; see eclipse-ee4j/servlet-api#44. Therefore network IO failures may occur simply because a client has gone away, and that can fill the logs with unnecessary stack traces.

      We make a best effort to identify such network failures, on a per-server basis, and log them under a separate log category. A simple one-line message is logged at DEBUG level, while a full stack trace is shown at TRACE level.

      See Also:
    • disconnectedClientLogger

      protected static final Log disconnectedClientLogger
      Separate logger to use on network IO failure after a client has gone away.
      See Also:
    • logger

      protected final Log logger
    • responseLock

      protected final Object responseLock
  • Constructor Details

    • AbstractSockJsSession

      public AbstractSockJsSession(String id, SockJsServiceConfig config, WebSocketHandler handler, @Nullable Map<String,Object> attributes)
      Create a new instance.
      Parameters:
      id - the session ID
      config - the SockJS service configuration options
      handler - the recipient of SockJS messages
      attributes - the attributes from the HTTP handshake to associate with the WebSocket session; the provided attributes are copied, the original map is not used.
  • Method Details