public class ReactorNettyWebSocketClient extends Object implements WebSocketClient
WebSocketClient
implementation for use with Reactor Netty.Constructor and Description |
---|
ReactorNettyWebSocketClient()
Default constructor.
|
ReactorNettyWebSocketClient(reactor.netty.http.client.HttpClient httpClient)
Constructor that accepts an existing
HttpClient builder
with a default WebsocketClientSpec.Builder . |
ReactorNettyWebSocketClient(reactor.netty.http.client.HttpClient httpClient,
Supplier<reactor.netty.http.client.WebsocketClientSpec.Builder> builderSupplier)
Constructor that accepts an existing
HttpClient builder
and a pre-configured WebsocketClientSpec.Builder . |
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<Void> |
execute(URI url,
HttpHeaders requestHeaders,
WebSocketHandler handler)
A variant of
WebSocketClient.execute(URI, WebSocketHandler) with custom headers. |
reactor.core.publisher.Mono<Void> |
execute(URI url,
WebSocketHandler handler)
Execute a handshake request to the given url and handle the resulting
WebSocket session with the given handler.
|
boolean |
getHandlePing()
Deprecated.
as of 5.3 in favor of
getWebsocketClientSpec() |
reactor.netty.http.client.HttpClient |
getHttpClient()
Return the configured
HttpClient . |
int |
getMaxFramePayloadLength()
Deprecated.
as of 5.3 in favor of
getWebsocketClientSpec() |
reactor.netty.http.client.WebsocketClientSpec |
getWebsocketClientSpec()
Build an instance of
WebsocketClientSpec that reflects the current
configuration. |
void |
setHandlePing(boolean handlePing)
Deprecated.
as of 5.3 in favor of providing a supplier of
WebsocketClientSpec.Builder with a
constructor argument |
void |
setMaxFramePayloadLength(int maxFramePayloadLength)
Deprecated.
as of 5.3 in favor of providing a supplier of
WebsocketClientSpec.Builder with a
constructor argument |
public ReactorNettyWebSocketClient()
public ReactorNettyWebSocketClient(reactor.netty.http.client.HttpClient httpClient)
HttpClient
builder
with a default WebsocketClientSpec.Builder
.public ReactorNettyWebSocketClient(reactor.netty.http.client.HttpClient httpClient, Supplier<reactor.netty.http.client.WebsocketClientSpec.Builder> builderSupplier)
HttpClient
builder
and a pre-configured WebsocketClientSpec.Builder
.public reactor.netty.http.client.HttpClient getHttpClient()
HttpClient
.public reactor.netty.http.client.WebsocketClientSpec getWebsocketClientSpec()
WebsocketClientSpec
that reflects the current
configuration. This can be used to check the configured parameters except
for sub-protocols which depend on the WebSocketHandler
that is used
for a given upgrade.@Deprecated public void setMaxFramePayloadLength(int maxFramePayloadLength)
WebsocketClientSpec.Builder
with a
constructor argumentCorresponds to the argument with the same name in the constructor of
WebSocketServerHandshakerFactory
in Netty.
By default set to 65536 (64K).
maxFramePayloadLength
- the max length for frames.@Deprecated public int getMaxFramePayloadLength()
getWebsocketClientSpec()
maxFramePayloadLength
.@Deprecated public void setHandlePing(boolean handlePing)
WebsocketClientSpec.Builder
with a
constructor argumentWebSocketHandler
given to the execute method. By default, Reactor
Netty automatically replies with pong frames in response to pings. This is
useful in a proxy for allowing ping and pong frames through.
By default this is set to false
in which case ping frames are
handled automatically by Reactor Netty. If set to true
, ping
frames will be passed through to the WebSocketHandler
.
handlePing
- whether to let Ping frames through for handling@Deprecated public boolean getHandlePing()
getWebsocketClientSpec()
setHandlePing(boolean)
.public reactor.core.publisher.Mono<Void> execute(URI url, WebSocketHandler handler)
WebSocketClient
execute
in interface WebSocketClient
url
- the handshake urlhandler
- the handler of the WebSocket sessionMono<Void>
to indicate the outcome of the
WebSocket session handling.public reactor.core.publisher.Mono<Void> execute(URI url, HttpHeaders requestHeaders, WebSocketHandler handler)
WebSocketClient
WebSocketClient.execute(URI, WebSocketHandler)
with custom headers.execute
in interface WebSocketClient
url
- the handshake urlrequestHeaders
- custom headers for the handshake requesthandler
- the handler of the WebSocket sessionMono<Void>
to indicate the outcome of the
WebSocket session handling.