Package reactor.netty.http.client
Interface HttpClient.WebsocketReceiver<S extends HttpClient.WebsocketReceiver<?>>
- All Superinterfaces:
HttpClient.UriConfiguration<S>
- All Known Subinterfaces:
HttpClient.WebsocketSender
- Enclosing class:
- HttpClient
public static interface HttpClient.WebsocketReceiver<S extends HttpClient.WebsocketReceiver<?>>
extends HttpClient.UriConfiguration<S>
Allow a websocket handling. Since
HttpClient.WebsocketReceiver
API returns
Flux
or Mono
, requesting is always deferred to
Publisher.subscribe(Subscriber)
.-
Method Summary
Modifier and TypeMethodDescriptionMono<? extends Connection>
connect()
Negotiate a websocket upgrade and return aMono
ofConnection
.<V> Flux<V>
handle
(BiFunction<? super WebsocketInbound, ? super WebsocketOutbound, ? extends Publisher<V>> receiver) Negotiate a websocket upgrade and extract a flux from the givenWebsocketInbound
andWebsocketOutbound
.receive()
Negotiate a websocket upgrade and extract a flux from the underlyingWebsocketInbound
.Methods inherited from interface reactor.netty.http.client.HttpClient.UriConfiguration
uri, uri, uri
-
Method Details
-
connect
Mono<? extends Connection> connect()Negotiate a websocket upgrade and return aMono
ofConnection
. IfMono
is cancelled, the underlying connection will be aborted. Once theConnection
has been emitted and is not necessary anymore, disposing must be done by the user viaDisposableChannel.dispose()
. If update configuration phase fails, aMono.error(Throwable)
will be returned- Returns:
- a
Mono
ofConnection
-
handle
<V> Flux<V> handle(BiFunction<? super WebsocketInbound, ? super WebsocketOutbound, ? extends Publisher<V>> receiver) Negotiate a websocket upgrade and extract a flux from the givenWebsocketInbound
andWebsocketOutbound
.The connection will not automatically
DisposableChannel.dispose()
and manual disposing with theConnection
,WebsocketOutbound.sendClose()
or the returnedFlux
might be necessary if the remote never terminates itself.If the upgrade fails, the returned
Flux
will emit aWebSocketHandshakeException
-
receive
ByteBufFlux receive()Negotiate a websocket upgrade and extract a flux from the underlyingWebsocketInbound
.The connection will be disposed when the underlying subscriber is disposed OR when a close frame has been received, forwarding onComplete to the returned flux subscription.
If the upgrade fails, the returned
Flux
will emit aWebSocketHandshakeException
- Returns:
- a
ByteBufFlux
of the inbound websocket content
-