Interface WebSocketListener
- All Superinterfaces:
SubProtocolCapable
- All Known Implementing Classes:
WebSocketInboundChannelAdapter
public interface WebSocketListener extends SubProtocolCapable
A contract for handling incoming
WebSocketMessage
s 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:
WebSocketInboundChannelAdapter
-
Method Summary
Modifier and Type Method Description void
afterSessionEnded(WebSocketSession session, CloseStatus closeStatus)
Invoked after aWebSocketSession
has ended.void
afterSessionStarted(WebSocketSession session)
Invoked after aWebSocketSession
has started.void
onMessage(WebSocketSession session, WebSocketMessage<?> message)
Handle the receivedWebSocketMessage
.
-
Method Details
-
onMessage
Handle the receivedWebSocketMessage
.- Parameters:
session
- the WebSocket sessionmessage
- the WebSocket message- Throws:
Exception
- the 'onMessage' Exception
-
afterSessionStarted
Invoked after aWebSocketSession
has started.- Parameters:
session
- the WebSocket session- Throws:
Exception
- the 'afterSessionStarted' Exception
-
afterSessionEnded
Invoked after aWebSocketSession
has ended.- Parameters:
session
- the WebSocket sessioncloseStatus
- the reason why the session was closed- Throws:
Exception
- the 'afterSessionEnded' Exception
-