Interface SubProtocolHandler
- All Known Implementing Classes:
- StompSubProtocolHandler
public interface SubProtocolHandler
A contract for handling WebSocket messages as part of a higher level protocol,
 referred to as "sub-protocol" in the WebSocket RFC specification.
 Handles both 
WebSocketMessages from a client
 as well as Messages to a client.
 Implementations of this interface can be configured on a
 SubProtocolWebSocketHandler which selects a sub-protocol handler to
 delegate messages to based on the sub-protocol requested by the client through
 the Sec-WebSocket-Protocol request header.
- Since:
- 4.0
- Author:
- Andy Wilkinson, Rossen Stoyanchev
- 
Method SummaryModifier and TypeMethodDescriptionvoidafterSessionEnded(WebSocketSession session, CloseStatus closeStatus, MessageChannel outputChannel) Invoked after aWebSocketSessionhas ended.voidafterSessionStarted(WebSocketSession session, MessageChannel outputChannel) Invoked after aWebSocketSessionhas started.Return the list of sub-protocols supported by this handler (nevernull).voidhandleMessageFromClient(WebSocketSession session, WebSocketMessage<?> message, MessageChannel outputChannel) Handle the givenWebSocketMessagereceived from a client.voidhandleMessageToClient(WebSocketSession session, Message<?> message) Handle the givenMessageto the client associated with the given WebSocket session.resolveSessionId(Message<?> message) Resolve the session id from the given message or returnnull.
- 
Method Details- 
getSupportedProtocolsReturn the list of sub-protocols supported by this handler (nevernull).
- 
handleMessageFromClientvoid handleMessageFromClient(WebSocketSession session, WebSocketMessage<?> message, MessageChannel outputChannel) throws Exception Handle the givenWebSocketMessagereceived from a client.- Parameters:
- session- the client session
- message- the client message
- outputChannel- an output channel to send messages to
- Throws:
- Exception
 
- 
handleMessageToClientHandle the givenMessageto the client associated with the given WebSocket session.- Parameters:
- session- the client session
- message- the client message
- Throws:
- Exception
 
- 
resolveSessionIdResolve the session id from the given message or returnnull.- Parameters:
- message- the message to resolve the session id from
 
- 
afterSessionStartedInvoked after aWebSocketSessionhas started.- Parameters:
- session- the client session
- outputChannel- a channel
- Throws:
- Exception
 
- 
afterSessionEndedvoid afterSessionEnded(WebSocketSession session, CloseStatus closeStatus, MessageChannel outputChannel) throws Exception Invoked after aWebSocketSessionhas ended.- Parameters:
- session- the client session
- closeStatus- the reason why the session was closed
- outputChannel- a channel
- Throws:
- Exception
 
 
-