spring-framework / org.springframework.web.socket.handler

Package org.springframework.web.socket.handler

Types

BinaryWebSocketHandler

open class BinaryWebSocketHandler : AbstractWebSocketHandler

A convenient base class for WebSocketHandler implementations that process binary messages only.

Text messages are rejected with CloseStatus#NOT_ACCEPTABLE. All other methods have empty implementations.

ConcurrentWebSocketSessionDecorator

open class ConcurrentWebSocketSessionDecorator : WebSocketSessionDecorator

Wrap a org.springframework.web.socket.WebSocketSession to guarantee only one thread can send messages at a time.

If a send is slow, subsequent attempts to send more messages from other threads will not be able to acquire the flush lock and messages will be buffered instead. At that time, the specified buffer-size limit and send-time limit will be checked and the session will be closed if the limits are exceeded.

ExceptionWebSocketHandlerDecorator

open class ExceptionWebSocketHandlerDecorator : WebSocketHandlerDecorator

An exception handling WebSocketHandlerDecorator. Traps all Throwable instances that escape from the decorated handler and closes the session with CloseStatus#SERVER_ERROR.

LoggingWebSocketHandlerDecorator

open class LoggingWebSocketHandlerDecorator : WebSocketHandlerDecorator

A WebSocketHandlerDecorator that adds logging to WebSocket lifecycle events.

PerConnectionWebSocketHandler

open class PerConnectionWebSocketHandler : WebSocketHandler, BeanFactoryAware

A WebSocketHandler that initializes and destroys a WebSocketHandler instance for each WebSocket connection and delegates all other methods to it.

Essentially create an instance of this class once, providing the type of WebSocketHandler class to create for each connection, and then pass it to any API method that expects a WebSocketHandler.

If initializing the target WebSocketHandler type requires a Spring BeanFctory, then the #setBeanFactory(BeanFactory) property accordingly. Simply declaring this class as a Spring bean will do that. Otherwise, WebSocketHandler instances of the target type will be created using the default constructor.

TextWebSocketHandler

open class TextWebSocketHandler : AbstractWebSocketHandler

A convenient base class for WebSocketHandler implementations that process text messages only.

Binary messages are rejected with CloseStatus#NOT_ACCEPTABLE. All other methods have empty implementations.

WebSocketHandlerDecorator

open class WebSocketHandlerDecorator : WebSocketHandler

Wraps another org.springframework.web.socket.WebSocketHandler instance and delegates to it.

Also provides a #getDelegate() method to return the decorated handler as well as a #getLastHandler() method to go through all nested delegates and return the "last" handler.

WebSocketHandlerDecoratorFactory

interface WebSocketHandlerDecoratorFactory

A factory for applying decorators to a WebSocketHandler.

Decoration should be done through sub-classing org.springframework.web.socket.handler.WebSocketHandlerDecorator to allow any code to traverse decorators and/or unwrap the original handler when necessary .

Exceptions

SessionLimitExceededException

open class SessionLimitExceededException : RuntimeException

Raised when a WebSocket session has exceeded limits it has been configured for, e.g. timeout, buffer size, etc.