public interface WebSocketHandler
Implementations of this interface are encouraged to handle exceptions locally where
it makes sense or alternatively let the exception bubble up in which case the exception
is logged and the session closed with
SERVER_ERROR(1011)
by default. The exception handling
strategy is provided by
ExceptionWebSocketHandlerDecorator
, which can be customized or replaced by decorating
the WebSocketHandler
with a different decorator.
Modifier and Type | Method and Description |
---|---|
void |
afterConnectionClosed(WebSocketSession session,
CloseStatus closeStatus)
Invoked after the WebSocket connection has been closed by either side, or after a
transport error has occurred.
|
void |
afterConnectionEstablished(WebSocketSession session)
Invoked after WebSocket negotiation has succeeded and the WebSocket connection is
opened and ready for use.
|
void |
handleMessage(WebSocketSession session,
WebSocketMessage<?> message)
Invoked when a new WebSocket message arrives.
|
void |
handleTransportError(WebSocketSession session,
java.lang.Throwable exception)
Handle an error from the underlying WebSocket message transport.
|
boolean |
supportsPartialMessages()
Whether the WebSocketHandler handles messages in parts.
|
void afterConnectionEstablished(WebSocketSession session) throws java.lang.Exception
java.lang.Exception
- this method can handle or propagate exceptions; see class-level
Javadoc for details.void handleMessage(WebSocketSession session, WebSocketMessage<?> message) throws java.lang.Exception
java.lang.Exception
- this method can handle or propagate exceptions; see class-level
Javadoc for details.void handleTransportError(WebSocketSession session, java.lang.Throwable exception) throws java.lang.Exception
java.lang.Exception
- this method can handle or propagate exceptions; see class-level
Javadoc for details.void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws java.lang.Exception
java.lang.Exception
- this method can handle or propagate exceptions; see class-level
Javadoc for details.boolean supportsPartialMessages()