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 aMonoofConnection.<V> Flux<V>handle(BiFunction<? super WebsocketInbound, ? super WebsocketOutbound, ? extends Publisher<V>> receiver) Negotiate a websocket upgrade and extract a flux from the givenWebsocketInboundandWebsocketOutbound.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 aMonoofConnection. IfMonois cancelled, the underlying connection will be aborted. Once theConnectionhas 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
MonoofConnection
-
handle
<V> Flux<V> handle(BiFunction<? super WebsocketInbound, ? super WebsocketOutbound, ? extends Publisher<V>> receiver) Negotiate a websocket upgrade and extract a flux from the givenWebsocketInboundandWebsocketOutbound.The connection will not automatically
DisposableChannel.dispose()and manual disposing with theConnection,WebsocketOutbound.sendClose()or the returnedFluxmight be necessary if the remote never terminates itself.If the upgrade fails, the returned
Fluxwill 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
Fluxwill emit aWebSocketHandshakeException- Returns:
- a
ByteBufFluxof the inbound websocket content
-