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

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.

Author
Rossen Stoyanchev

Author
Phillip Webb

Since
4.0

Constructors

<init>

TextWebSocketHandler()

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.

Inheritors

SockJsWebSocketHandler

open class SockJsWebSocketHandler : TextWebSocketHandler, SubProtocolCapable

An implementation of WebSocketHandler that adds SockJS messages frames, sends SockJS heartbeat messages, and delegates lifecycle events and messages to a target WebSocketHandler.

Methods in this class allow exceptions from the wrapped WebSocketHandler to propagate. However, any exceptions resulting from SockJS message handling (e.g. while sending SockJS frames or heartbeat messages) are caught and treated as transport errors, i.e. routed to the handleTransportError method of the wrapped handler and the session closed.