Top Description Methods
io.vertx.core.http

public Interface ClientWebSocket

extends WebSocket
Known Direct Subinterfaces
io.vertx.core.http.impl.ClientWebSocketInternal
Annotations
@VertxGen
Imports
io.vertx.codegen.annotations.Nullable, .VertxGen, io.vertx.core.AsyncResult, .Future, .Handler, io.vertx.core.buffer.Buffer

Represents a client-side WebSocket initially not connected.
Author
Julien Viet

Method Summary

Modifier and TypeMethod and Description
public ClientWebSocket
public ClientWebSocket
public default void
connect(int
the port
port
,
String
the host
host
,
String
the relative URI
requestURI
,
Handler<AsyncResult<WebSocket>>
handler that will be called with the WebSocket when connected
handler
)

Connect a WebSocket to the specified port, host and relative request URI

public default Future<WebSocket>
connect(int port, String host, String requestURI)

Like connect(int, String, String, Handler) but returns a Future of the asynchronous result

public void
connect(WebSocketConnectOptions
the request options
options
,
Handler<AsyncResult<WebSocket>>
handler that will be called with the WebSocket when connected
handler
)

Connect a WebSocket with the specified options.

public Future<WebSocket>
connect(WebSocketConnectOptions options)

Like connect(WebSocketConnectOptions, Handler) but returns a Future of the asynchronous result

public default void
connect(String
the host
host
,
String
the relative URI
requestURI
,
Handler<AsyncResult<WebSocket>>
handler that will be called with the WebSocket when connected
handler
)

Connect this WebSocket to the host and relative request URI and default port.

public default Future<WebSocket>

Returns:

a future notified when the WebSocket when connected
connect
(String
the host
host
,
String
the relative URI
requestURI
)

Connect this WebSocket to the host and relative request URI and default port.

public default void
connect(String
the relative URI
requestURI
,
Handler<AsyncResult<WebSocket>>
handler that will be called with the WebSocket when connected
handler
)

Connect this WebSocket at the relative request URI using the default host and port.

public default Future<WebSocket>

Returns:

a future notified when the WebSocket when connected
connect
(String
the relative URI
requestURI
)

Connect this WebSocket at the relative request URI using the default host and port.

public ClientWebSocket
public ClientWebSocket
public ClientWebSocket
public ClientWebSocket
public ClientWebSocket
public ClientWebSocket
public ClientWebSocket
public ClientWebSocket
writeBinaryMessage(Buffer data, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocket.writeBinaryMessage.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Same as writeBinaryMessage(Buffer) but with an handler called when the operation completes

public ClientWebSocket
writeFinalBinaryFrame(Buffer data, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocket.writeFinalBinaryFrame.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Same as writeFinalBinaryFrame(Buffer, Handler) but with an handler called when the operation completes

public ClientWebSocket
writeFinalTextFrame(String text, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocket.writeFinalTextFrame.

Same as writeFinalTextFrame(String, Handler) but with an handler called when the operation completes

public ClientWebSocket
writeFrame(WebSocketFrame frame, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocket.writeFrame.

Same as writeFrame(WebSocketFrame) but with an handler called when the operation completes

public ClientWebSocket
writePing(Buffer
the data to write, may be at most 125 bytes
data
,
Handler<AsyncResult<Void>>
called when the ping frame has been successfully written
handler
)

Redeclares io.vertx.core.http.WebSocket.writePing.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Writes a ping frame to the connection.

public ClientWebSocket
writePong(Buffer
the data to write, may be at most 125 bytes
data
,
Handler<AsyncResult<Void>>
called when the pong frame has been successfully written
handler
)

Redeclares io.vertx.core.http.WebSocket.writePong.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Writes a pong frame to the connection.

public ClientWebSocket
writeTextMessage(String text, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocket.writeTextMessage.

Same as writeTextMessage(String) but with an handler called when the operation completes

Inherited from io.vertx.core.http.WebSocket:
fetchpauseresumesetWriteQueueMaxSize

Method Detail

binaryMessageHandlerback to summary
public ClientWebSocket binaryMessageHandler(@Nullable Handler<Buffer> handler)
Annotations
@Override
closeHandlerback to summary
public ClientWebSocket closeHandler(Handler<Void> handler)

Redeclares io.vertx.core.http.WebSocket.closeHandler.

Annotations
@Override
connectback to summary
public default void connect(int port, String host, String requestURI, Handler<AsyncResult<WebSocket>> handler)

Connect a WebSocket to the specified port, host and relative request URI

Parameters
port:int

the port

host:String

the host

requestURI:String

the relative URI

handler:Handler<AsyncResult<WebSocket>>

handler that will be called with the WebSocket when connected

connectback to summary
public default Future<WebSocket> connect(int port, String host, String requestURI)

Like connect(int, String, String, Handler) but returns a Future of the asynchronous result

connectback to summary
public void connect(WebSocketConnectOptions options, Handler<AsyncResult<WebSocket>> handler)

Connect a WebSocket with the specified options.

Parameters
options:WebSocketConnectOptions

the request options

handler:Handler<AsyncResult<WebSocket>>

handler that will be called with the WebSocket when connected

connectback to summary
public Future<WebSocket> connect(WebSocketConnectOptions options)

Like connect(WebSocketConnectOptions, Handler) but returns a Future of the asynchronous result

connectback to summary
public default void connect(String host, String requestURI, Handler<AsyncResult<WebSocket>> handler)

Connect this WebSocket to the host and relative request URI and default port.

Parameters
host:String

the host

requestURI:String

the relative URI

handler:Handler<AsyncResult<WebSocket>>

handler that will be called with the WebSocket when connected

connectback to summary
public default Future<WebSocket> connect(String host, String requestURI)

Connect this WebSocket to the host and relative request URI and default port.

Parameters
host:String

the host

requestURI:String

the relative URI

Returns:Future<WebSocket>

a future notified when the WebSocket when connected

connectback to summary
public default void connect(String requestURI, Handler<AsyncResult<WebSocket>> handler)

Connect this WebSocket at the relative request URI using the default host and port.

Parameters
requestURI:String

the relative URI

handler:Handler<AsyncResult<WebSocket>>

handler that will be called with the WebSocket when connected

connectback to summary
public default Future<WebSocket> connect(String requestURI)

Connect this WebSocket at the relative request URI using the default host and port.

Parameters
requestURI:String

the relative URI

Returns:Future<WebSocket>

a future notified when the WebSocket when connected

drainHandlerback to summary
public ClientWebSocket drainHandler(Handler<Void> handler)

Redeclares io.vertx.core.http.WebSocket.drainHandler.

Annotations
@Override
endHandlerback to summary
public ClientWebSocket endHandler(Handler<Void> endHandler)

Redeclares io.vertx.core.http.WebSocket.endHandler.

Annotations
@Override
exceptionHandlerback to summary
public ClientWebSocket exceptionHandler(Handler<Throwable> handler)

Redeclares io.vertx.core.http.WebSocket.exceptionHandler.

Annotations
@Override
frameHandlerback to summary
public ClientWebSocket frameHandler(Handler<WebSocketFrame> handler)

Redeclares io.vertx.core.http.WebSocket.frameHandler.

Annotations
@Override
handlerback to summary
public ClientWebSocket handler(Handler<Buffer> handler)

Redeclares io.vertx.core.http.WebSocket.handler.

Annotations
@Override
pongHandlerback to summary
public ClientWebSocket pongHandler(@Nullable Handler<Buffer> handler)
Annotations
@Override
textMessageHandlerback to summary
public ClientWebSocket textMessageHandler(@Nullable Handler<String> handler)
Annotations
@Override
writeBinaryMessageback to summary
public ClientWebSocket writeBinaryMessage(Buffer data, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocket.writeBinaryMessage.

Doc from io.vertx.core.http.WebSocketBase.writeBinaryMessage.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Same as writeBinaryMessage(Buffer) but with an handler called when the operation completes

Annotations
@Override
writeFinalBinaryFrameback to summary
public ClientWebSocket writeFinalBinaryFrame(Buffer data, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocket.writeFinalBinaryFrame.

Doc from io.vertx.core.http.WebSocketBase.writeFinalBinaryFrame.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Same as writeFinalBinaryFrame(Buffer, Handler) but with an handler called when the operation completes

Annotations
@Override
writeFinalTextFrameback to summary
public ClientWebSocket writeFinalTextFrame(String text, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocket.writeFinalTextFrame.

Doc from io.vertx.core.http.WebSocketBase.writeFinalTextFrame.

Same as writeFinalTextFrame(String, Handler) but with an handler called when the operation completes

Annotations
@Override
writeFrameback to summary
public ClientWebSocket writeFrame(WebSocketFrame frame, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocket.writeFrame.

Doc from io.vertx.core.http.WebSocketBase.writeFrame.

Same as writeFrame(WebSocketFrame) but with an handler called when the operation completes

Annotations
@Override
writePingback to summary
public ClientWebSocket writePing(Buffer data, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocket.writePing.

Doc from io.vertx.core.http.WebSocketBase.writePing.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Writes a ping frame to the connection. This will be written in a single frame. Ping frames may be at most 125 bytes (octets).

This method should not be used to write application data and should only be used for implementing a keep alive or to ensure the client is still responsive, see RFC 6455 Section section 5.5.2.

There is no handler for ping frames because RFC 6455 clearly states that the only response to a ping frame is a pong frame with identical contents.

Parameters
data:Buffer

the data to write, may be at most 125 bytes

handler:Handler<AsyncResult<Void>>

called when the ping frame has been successfully written

Returns:ClientWebSocket

a reference to this, so the API can be used fluently

Annotations
@Override
writePongback to summary
public ClientWebSocket writePong(Buffer data, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocket.writePong.

Doc from io.vertx.core.http.WebSocketBase.writePong.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Writes a pong frame to the connection. This will be written in a single frame. Pong frames may be at most 125 bytes (octets).

This method should not be used to write application data and should only be used for implementing a keep alive or to ensure the client is still responsive, see RFC 6455 section 5.5.2.

There is no need to manually write a pong frame, as the server and client both handle responding to a ping from with a pong from automatically and this is exposed to users. RFC 6455 section 5.5.3 states that pongs may be sent unsolicited in order to implement a one way heartbeat.

Parameters
data:Buffer

the data to write, may be at most 125 bytes

handler:Handler<AsyncResult<Void>>

called when the pong frame has been successfully written

Returns:ClientWebSocket

a reference to this, so the API can be used fluently

Annotations
@Override
writeTextMessageback to summary
public ClientWebSocket writeTextMessage(String text, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocket.writeTextMessage.

Doc from io.vertx.core.http.WebSocketBase.writeTextMessage.

Same as writeTextMessage(String) but with an handler called when the operation completes

Annotations
@Override