public static interface HttpClient.WebsocketReceiver<S extends HttpClient.WebsocketReceiver<?>> extends HttpClient.UriConfiguration<S>
HttpClient.WebsocketReceiver
API returns
Flux
or Mono
, requesting is always deferred to
Publisher.subscribe(Subscriber)
.Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<? extends Connection> |
connect()
Negotiate a websocket upgrade and return a
Mono of Connection . |
<V> reactor.core.publisher.Flux<V> |
handle(java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<V>> receiver)
Negotiate a websocket upgrade and extract a flux from the given
WebsocketInbound and WebsocketOutbound . |
ByteBufFlux |
receive()
Negotiate a websocket upgrade and extract a flux from the underlying
WebsocketInbound . |
uri, uri
reactor.core.publisher.Mono<? extends Connection> connect()
Mono
of Connection
. If
Mono
is cancelled, the underlying connection will be aborted. Once the
Connection
has been emitted and is not necessary anymore, disposing must be
done by the user via DisposableChannel.dispose()
.
If update configuration phase fails, a Mono.error(Throwable)
will be returnedMono
of Connection
<V> reactor.core.publisher.Flux<V> handle(java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<V>> receiver)
WebsocketInbound
and WebsocketOutbound
.
The connection will not automatically DisposableChannel.dispose()
and
manual disposing with the Connection
,
WebsocketOutbound.sendClose()
or the returned Flux
might be necessary if the remote never
terminates itself.
If the upgrade fails, the returned Flux
will emit a
WebSocketHandshakeException
V
- the extracted flux typereceiver
- extracting receiverFlux
of the extracted data via the returned Publisher
ByteBufFlux receive()
WebsocketInbound
.
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 a
WebSocketHandshakeException
ByteBufFlux
of the inbound websocket content