Interface WebSocketListener
- All Superinterfaces:
SubProtocolCapable
- All Known Implementing Classes:
WebSocketInboundChannelAdapter
A contract for handling incoming
WebSocketMessages messages as part of a higher
level protocol, referred to as "sub-protocol" in the WebSocket RFC specification.
Implementations of this interface can be configured on a
IntegrationWebSocketContainer which delegates messages and
WebSocketSession events to this implementation.
- Since:
- 4.1
- Author:
- Andy Wilkinson, Artem Bilan
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidafterSessionEnded(WebSocketSession session, CloseStatus closeStatus) Invoked after aWebSocketSessionhas ended.voidafterSessionStarted(WebSocketSession session) Invoked after aWebSocketSessionhas started.voidonMessage(WebSocketSession session, WebSocketMessage<?> message) Handle the receivedWebSocketMessage.Methods inherited from interface org.springframework.web.socket.SubProtocolCapable
getSubProtocols
-
Method Details
-
onMessage
Handle the receivedWebSocketMessage.- Parameters:
session- the WebSocket sessionmessage- the WebSocket message
-
afterSessionStarted
Invoked after aWebSocketSessionhas started.- Parameters:
session- the WebSocket session
-
afterSessionEnded
Invoked after aWebSocketSessionhas ended.- Parameters:
session- the WebSocket sessioncloseStatus- the reason why the session was closed
-