Top Description Methods
io.vertx.core.http

public Interface WebSocket

extends WebSocketBase
Known Direct Subinterfaces
io.vertx.core.http.ClientWebSocket
Known Direct Implementers
io.vertx.core.http.impl.WebSocketImpl
Annotations
@VertxGen
Imports
io.vertx.codegen.annotations.VertxGen, io.vertx.core.AsyncResult, .Handler, io.vertx.core.buffer.Buffer

Represents a client-side WebSocket.
Author
Tim Fox

Method Summary

Modifier and TypeMethod and Description
public WebSocket
public WebSocket
public WebSocket
public WebSocket
public WebSocket
fetch(long amount)

Redeclares io.vertx.core.http.WebSocketBase.fetch.

Fetch the specified amount of elements.

public WebSocket
public WebSocket
public WebSocket
pause()

Redeclares io.vertx.core.http.WebSocketBase.pause.

Pause the ReadStream, it sets the buffer in fetch mode and clears the actual demand.

public WebSocket
resume()

Redeclares io.vertx.core.http.WebSocketBase.resume.

Resume reading, and sets the buffer in flowing mode.

public WebSocket
setWriteQueueMaxSize(int
the max size of the write stream
maxSize
)

Redeclares io.vertx.core.http.WebSocketBase.setWriteQueueMaxSize.

Set the maximum size of the write queue to maxSize.

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

Redeclares io.vertx.core.http.WebSocketBase.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 WebSocket
writeFinalBinaryFrame(Buffer data, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocketBase.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 WebSocket
writeFinalTextFrame(String text, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocketBase.writeFinalTextFrame.

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

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

Redeclares io.vertx.core.http.WebSocketBase.writeFrame.

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

public WebSocket
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.WebSocketBase.writePing.

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

Writes a ping frame to the connection.

public WebSocket
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.WebSocketBase.writePong.

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

Writes a pong frame to the connection.

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

Redeclares io.vertx.core.http.WebSocketBase.writeTextMessage.

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

Inherited from io.vertx.core.http.WebSocketBase:
binaryHandlerIDbinaryMessageHandlercloseclosecloseclosecloseclosecloseHandlercloseReasoncloseStatusCodeendendframeHandlerheadersisClosedisSsllocalAddresspeerCertificateChainpeerCertificatespongHandlerremoteAddresssslSessionsubProtocoltextHandlerIDtextMessageHandlerwriteBinaryMessagewriteFinalBinaryFramewriteFinalTextFramewriteFramewritePingwritePongwriteTextMessage

Method Detail

closeHandlerback to summary
public WebSocket closeHandler(Handler<Void> handler)
Annotations
@Override
drainHandlerback to summary
public WebSocket drainHandler(Handler<Void> handler)

Redeclares io.vertx.core.http.WebSocketBase.drainHandler.

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

Redeclares io.vertx.core.http.WebSocketBase.endHandler.

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

Redeclares io.vertx.core.http.WebSocketBase.exceptionHandler.

Annotations
@Override
fetchback to summary
public WebSocket fetch(long amount)

Redeclares io.vertx.core.http.WebSocketBase.fetch.

Doc from io.vertx.core.streams.ReadStream.fetch.

Fetch the specified amount of elements. If the ReadStream has been paused, reading will recommence with the specified amount of items, otherwise the specified amount will be added to the current stream demand.

Returns:WebSocket

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

Annotations
@Override
frameHandlerback to summary
public WebSocket frameHandler(Handler<WebSocketFrame> handler)
Annotations
@Override
handlerback to summary
public WebSocket handler(Handler<Buffer> handler)

Redeclares io.vertx.core.http.WebSocketBase.handler.

Annotations
@Override
pauseback to summary
public WebSocket pause()

Redeclares io.vertx.core.http.WebSocketBase.pause.

Doc from io.vertx.core.streams.ReadStream.pause.

Pause the ReadStream, it sets the buffer in fetch mode and clears the actual demand.

While it's paused, no data will be sent to the data handler.

Returns:WebSocket

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

Annotations
@Override
resumeback to summary
public WebSocket resume()

Redeclares io.vertx.core.http.WebSocketBase.resume.

Doc from io.vertx.core.streams.ReadStream.resume.

Resume reading, and sets the buffer in flowing mode.

If the ReadStream has been paused, reading will recommence on it.

Returns:WebSocket

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

Annotations
@Override
setWriteQueueMaxSizeback to summary
public WebSocket setWriteQueueMaxSize(int maxSize)

Redeclares io.vertx.core.http.WebSocketBase.setWriteQueueMaxSize.

Doc from io.vertx.core.streams.WriteStream.setWriteQueueMaxSize.

Set the maximum size of the write queue to maxSize. You will still be able to write to the stream even if there is more than maxSize items in the write queue. This is used as an indicator by classes such as Pipe to provide flow control.

The value is defined by the implementation of the stream, e.g in bytes for a io.vertx.core.net.NetSocket, etc...

Parameters
maxSize:int

the max size of the write stream

Returns:WebSocket

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

Annotations
@Override
writeBinaryMessageback to summary
public WebSocket writeBinaryMessage(Buffer data, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocketBase.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 WebSocket writeFinalBinaryFrame(Buffer data, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocketBase.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 WebSocket writeFinalTextFrame(String text, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocketBase.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 WebSocket writeFrame(WebSocketFrame frame, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocketBase.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 WebSocket writePing(Buffer data, Handler<AsyncResult<Void>> handler)

Redeclares io.vertx.core.http.WebSocketBase.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:WebSocket

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

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

Redeclares io.vertx.core.http.WebSocketBase.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:WebSocket

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

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

Redeclares io.vertx.core.http.WebSocketBase.writeTextMessage.

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

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

Annotations
@Override