WebSocketHandlerthat adds SockJS messages frames, sends SockJS heartbeat messages, and delegates lifecycle events and messages to a target
Methods in this class allow exceptions from the wrapped
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.
- Rossen Stoyanchev
Method SummaryModifier and TypeMethodDescription
voidInvoked after the WebSocket connection has been closed by either side, or after a transport error has occurred.
voidInvoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.
protected SockJsServiceConfigReturn the list of supported sub-protocols.
voidHandle an error from the underlying WebSocket message transport.
Methods inherited from class org.springframework.web.socket.handler.TextWebSocketHandler
Methods inherited from class org.springframework.web.socket.handler.AbstractWebSocketHandler
handleMessage, handlePongMessage, supportsPartialMessages
getSubProtocolsDescription copied from interface:
SubProtocolCapableReturn the list of supported sub-protocols.
getSockJsConfigprotected SockJsServiceConfig getSockJsConfig()
afterConnectionEstablishedInvoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.
afterConnectionClosedInvoked after the WebSocket connection has been closed by either side, or after a transport error has occurred. Although the session may technically still be open, depending on the underlying implementation, sending messages at this point is discouraged and most likely will not succeed.
handleTransportErrorpublic void handleTransportError
(WebSocketSession webSocketSession, Throwable exception) throws ExceptionHandle an error from the underlying WebSocket message transport.