Top Description Fields Constructors Methods
io.rsocket.transport.netty.client

public final Class WebsocketClientTransport

extends Object
implements ClientTransport
Class Inheritance
All Implemented Interfaces
io.rsocket.transport.ClientTransport, io.rsocket.transport.Transport
Static Imports
io.rsocket.frame.FrameLengthCodec.FRAME_LENGTH_MASK

An implementation of ClientTransport that connects to a ServerTransport over WebSocket.

Field Summary

Modifier and TypeField and Description
private final HttpClient
private static final String
private HttpHeaders
private final String
private final WebsocketClientSpec.Builder

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Mono<DuplexConnection>
connect()

Implements io.rsocket.transport.ClientTransport.connect.

Return a Mono that connects for each subscriber.
public static WebsocketClientTransport

Returns:

a new instance
create
(int
the port to connect to
port
)

Creates a new instance connecting to localhost

public static WebsocketClientTransport

Returns:

a new instance
create
(String
the address to connect to
bindAddress
,
int
the port to connect to
port
)

Creates a new instance

public static WebsocketClientTransport

Returns:

a new instance
create
(InetSocketAddress
the address to connect to
address
)

Creates a new instance

public static WebsocketClientTransport

Returns:

a new instance
create
(TcpClient
the TcpClient to use
client
)

Creates a new instance

public static WebsocketClientTransport

Returns:

a new instance
create
(URI
the URI to connect to
uri
)

Creates a new instance

public static WebsocketClientTransport

Returns:

a new instance
create
(HttpClient
the HttpClient to use
client
,
String
the path to request
path
)

Creates a new instance

public WebsocketClientTransport

Returns:

the same instance for method chaining
header
(String
the header name
name
,
String...
the header value(s)
values
)

Add a header and value(s) to use for the WebSocket handshake request.

public int
maxFrameLength()

Overrides default io.rsocket.transport.Transport.maxFrameLength.

Configurations that exposes the maximum frame size that a DuplexConnection can bring up to RSocket level.
public WebsocketClientTransport

Returns:

the same instance for method chaining
webSocketSpec
(Consumer<WebsocketClientSpec.Builder>
the configurer to apply to the spec
configurer
)

Provide a consumer to customize properties of the WebsocketClientSpec to use for WebSocket upgrades.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clientback to summary
private final HttpClient client
DEFAULT_PATHback to summary
private static final String DEFAULT_PATH
headersback to summary
private HttpHeaders headers
pathback to summary
private final String path
specBuilderback to summary
private final WebsocketClientSpec.Builder specBuilder

Constructor Detail

WebsocketClientTransportback to summary
private WebsocketClientTransport(HttpClient client, String path)

Method Detail

connectback to summary
public Mono<DuplexConnection> connect()

Implements io.rsocket.transport.ClientTransport.connect.

Doc from io.rsocket.transport.ClientTransport.connect.

Return a Mono that connects for each subscriber.

Annotations
@Override
createback to summary
public static WebsocketClientTransport create(int port)

Creates a new instance connecting to localhost

Parameters
port:int

the port to connect to

Returns:WebsocketClientTransport

a new instance

createback to summary
public static WebsocketClientTransport create(String bindAddress, int port)

Creates a new instance

Parameters
bindAddress:String

the address to connect to

port:int

the port to connect to

Returns:WebsocketClientTransport

a new instance

Exceptions
NullPointerException:
if bindAddress is null
createback to summary
public static WebsocketClientTransport create(InetSocketAddress address)

Creates a new instance

Parameters
address:InetSocketAddress

the address to connect to

Returns:WebsocketClientTransport

a new instance

Exceptions
NullPointerException:
if address is null
createback to summary
public static WebsocketClientTransport create(TcpClient client)

Creates a new instance

Parameters
client:TcpClient

the TcpClient to use

Returns:WebsocketClientTransport

a new instance

Exceptions
NullPointerException:
if client or path is null
createback to summary
public static WebsocketClientTransport create(URI uri)

Creates a new instance

Parameters
uri:URI

the URI to connect to

Returns:WebsocketClientTransport

a new instance

Exceptions
NullPointerException:
if uri is null
createback to summary
public static WebsocketClientTransport create(HttpClient client, String path)

Creates a new instance

Parameters
client:HttpClient

the HttpClient to use

path:String

the path to request

Returns:WebsocketClientTransport

a new instance

Exceptions
NullPointerException:
if client or path is null
headerback to summary
public WebsocketClientTransport header(String name, String... values)

Add a header and value(s) to use for the WebSocket handshake request.

Parameters
name:String

the header name

values:String[]

the header value(s)

Returns:WebsocketClientTransport

the same instance for method chaining

Since
1.0.1
maxFrameLengthback to summary
public int maxFrameLength()

Overrides default io.rsocket.transport.Transport.maxFrameLength.

Doc from io.rsocket.transport.Transport.maxFrameLength.

Configurations that exposes the maximum frame size that a DuplexConnection can bring up to RSocket level.

This number should not exist the 16,777,215 (maximum frame size specified by RSocket spec)

Returns:int

return maximum configured frame size limit

Annotations
@Override
webSocketSpecback to summary
public WebsocketClientTransport webSocketSpec(Consumer<WebsocketClientSpec.Builder> configurer)

Provide a consumer to customize properties of the WebsocketClientSpec to use for WebSocket upgrades. The consumer is invoked immediately.

Parameters
configurer:Consumer<WebsocketClientSpec.Builder>

the configurer to apply to the spec

Returns:WebsocketClientTransport

the same instance for method chaining

Since
1.0.1