Interface WebSocketExchangeHandler<A extends ExchangeContext,B extends WebSocketExchange<A>>
- Type Parameters:
A
- the type of the exchange contextB
- the type of WebSocket exchange handled by the handler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A WebSocket exchange handler is used to handle WebSocket exchange.
It allows to specify the behaviour of the server when a WebSocket connection has been established between a client and the server.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Method Summary
-
Method Details
-
defer
Returns a Mono that defers the processing of the WebSocket exchange.
The server subscribes to the returned Mono and after completion, emits received messages in the inbound frames stream and subscribes to the exchange outbound frames stream to send WebSocket frames to the client.
By default, returns a Mono that defers the execution of
handle(io.inverno.mod.http.server.ws.WebSocketExchange)
.- Parameters:
webSocketExchange
- the WebSocket exchange to process- Returns:
- an empty mono that completes when the WebSocket exchange has been processed
- Throws:
WebSocketException
- if an error occurs during the processing of the exchange
-
handle
Processes the specified WebSocket server exchange.
This method is more convenient than
defer(io.inverno.mod.http.server.ws.WebSocketExchange)
when the handling logic does not need to be reactive.- Parameters:
webSocketExchange
- the WebSocket exchange to process- Throws:
WebSocketException
- if an error occurs during the processing of the exchange
-