Class ContextWebSocketHandler
java.lang.Object
org.springframework.web.reactive.socket.adapter.ContextWebSocketHandler
- All Implemented Interfaces:
WebSocketHandler
WebSocketHandler decorator that enriches the context of the target handler.- Since:
- 5.3.3
- Author:
- Rossen Stoyanchev
-
Method Summary
Modifier and TypeMethodDescriptionstatic WebSocketHandlerdecorate(WebSocketHandler handler, reactor.util.context.ContextView contextView) Return the given handler, decorated to insert the given context, or the same handler instance when the context is empty.Return the list of sub-protocols supported by this handler.reactor.core.publisher.Mono<Void>handle(WebSocketSession session) Invoked when a new WebSocket connection is established, and allows handling of the session.
-
Method Details
-
getSubProtocols
Description copied from interface:WebSocketHandlerReturn the list of sub-protocols supported by this handler.By default an empty list is returned.
- Specified by:
getSubProtocolsin interfaceWebSocketHandler
-
handle
Description copied from interface:WebSocketHandlerInvoked when a new WebSocket connection is established, and allows handling of the session.See the class-level doc and the reference manual for more details and examples of how to handle the session.
- Specified by:
handlein interfaceWebSocketHandler- Parameters:
session- the session to handle- Returns:
- indicates when application handling of the session is complete, which should reflect the completion of the inbound message stream (i.e. connection closing) and possibly the completion of the outbound message stream and the writing of messages
-
decorate
public static WebSocketHandler decorate(WebSocketHandler handler, reactor.util.context.ContextView contextView) Return the given handler, decorated to insert the given context, or the same handler instance when the context is empty.
-