Interface WebSocket<A extends ExchangeContext,B extends WebSocketExchange<A>>
- Type Parameters:
A
- the type of the exchange contextB
- the type of WebSocket exchange
A server-side WebSocket.
A WebSocket is created by upgrading to the WebSocket protocol using Exchange.webSocket(java.lang.String...)
. It is used to specify the WebSocketExchangeHandler
which handles the
WebSocketExchange
once the opening handshake has been completed.
A fallback action can also be specified which is executed if the opening handshake failed.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Method Summary
Modifier and TypeMethodDescriptionhandler
(WebSocketExchangeHandler<? super A, B> handler) Specifies the handler used to handle the WebSocket exchange.Specifies the fallback action to execute when the opening handshake fails.Specifies a fallback action to execute when the opening handshake fails.
-
Method Details
-
handler
Specifies the handler used to handle the WebSocket exchange.
- Parameters:
handler
- a WebSocket exchange handler- Returns:
- this WebSocket
-
or
Specifies the fallback action to execute when the opening handshake fails.
Unlike
or(reactor.core.publisher.Mono)
, the specified fallback action is executed synchronously and might block the I/O thread.This is a convenience method which delegates to
or(reactor.core.publisher.Mono)
which should be prefered.- Parameters:
fallback
- a fallback action- Returns:
- this WebSocket
-
or
Specifies a fallback action to execute when the opening handshake fails.
Unlike
or(java.lang.Runnable)
, the specified fallback action is executed asynchronously and will not block the I/O thread.- Parameters:
fallback
- a fallback action- Returns:
- this WebSocket
-