public class ServerWebSocket extends Object implements WebSocketBase
Instances of this class are passed into a HttpServer.webSocketHandler(io.vertx.core.Handler<io.vertx.reactivex.core.http.ServerWebSocket>) or provided
when a WebSocket handshake is manually HttpServerRequest.toWebSocket(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.http.ServerWebSocket>>)ed.
original non RX-ified interface using Vert.x codegen.| Modifier and Type | Field and Description |
|---|---|
static io.vertx.lang.rx.TypeArg<ServerWebSocket> |
__TYPE_ARG |
| Constructor and Description |
|---|
ServerWebSocket(Object delegate) |
ServerWebSocket(ServerWebSocket delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept()
Accept the WebSocket and terminate the WebSocket handshake.
|
String |
binaryHandlerID()
When a
WebSocket is created, it may register an event handler with the event bus - the ID of that
handler is given by this method. |
WebSocketBase |
binaryMessageHandler(Handler<Buffer> handler)
Set a binary message handler on the connection.
|
void |
close()
Same as
close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
close(Handler<AsyncResult<Void>> handler)
Same as
close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
close(short statusCode)
Same as
WebSocketBase.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
close(short statusCode,
Handler<AsyncResult<Void>> handler)
Same as
WebSocketBase.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
close(short statusCode,
String reason)
Same as
WebSocketBase.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
close(short statusCode,
String reason,
Handler<AsyncResult<Void>> handler)
Same as
WebSocketBase.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
ServerWebSocket |
closeHandler(Handler<Void> handler)
Set a close handler.
|
String |
closeReason()
Returns the close reason message from the remote endpoint or
null when not yet received. |
Short |
closeStatusCode()
Returns the close status code received from the remote endpoint or
null when not yet received. |
ServerWebSocket |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
void |
end()
|
void |
end(Buffer data)
Same as but with an
handler called when the operation completes |
void |
end(Buffer data,
Handler<AsyncResult<Void>> handler)
Same as but with an
handler called when the operation completes |
void |
end(Handler<AsyncResult<Void>> handler)
|
ServerWebSocket |
endHandler(Handler<Void> endHandler)
Set an end handler.
|
boolean |
equals(Object o) |
ServerWebSocket |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
ServerWebSocket |
fetch(long amount)
Fetch the specified
amount of elements. |
ServerWebSocket |
frameHandler(Handler<WebSocketFrame> handler)
Set a frame handler on the connection.
|
ServerWebSocket |
getDelegate() |
ServerWebSocket |
handler(Handler<Buffer> handler)
Set a data handler.
|
int |
hashCode() |
MultiMap |
headers()
Returns the HTTP headers when the WebSocket is first obtained in the handler.
|
String |
host() |
boolean |
isClosed() |
boolean |
isSsl() |
SocketAddress |
localAddress() |
static ServerWebSocket |
newInstance(ServerWebSocket arg) |
String |
path() |
ServerWebSocket |
pause()
Pause the
ReadStream, it sets the buffer in fetch mode and clears the actual demand. |
Pipe<Buffer> |
pipe()
Pause this stream and return a to transfer the elements of this stream to a destination .
|
void |
pipeTo(WriteStream<Buffer> dst)
Pipe this
ReadStream to the WriteStream. |
void |
pipeTo(WriteStream<Buffer> dst,
Handler<AsyncResult<Void>> handler)
Pipe this
ReadStream to the WriteStream. |
WebSocketBase |
pongHandler(Handler<Buffer> handler)
Set a pong frame handler on the connection.
|
String |
query() |
void |
reject()
Reject the WebSocket.
|
void |
reject(int status)
Like
reject() but with a status. |
SocketAddress |
remoteAddress() |
ServerWebSocket |
resume()
Resume reading, and sets the buffer in
flowing mode. |
Completable |
rxClose()
Same as
close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Completable |
rxClose(short statusCode)
Same as
WebSocketBase.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Completable |
rxClose(short statusCode,
String reason)
Same as
WebSocketBase.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Completable |
rxEnd()
|
Completable |
rxEnd(Buffer data)
Same as but with an
handler called when the operation completes |
Completable |
rxPipeTo(WriteStream<Buffer> dst)
Pipe this
ReadStream to the WriteStream. |
Single<Integer> |
rxSetHandshake(Future<Integer> future)
Set an asynchronous result for the handshake, upon completion of the specified
future, the
WebSocket will either be
accepted when the future succeeds with the HTTP status code
rejected when the future is succeeds with an HTTP status code different than
rejected when the future fails with the HTTP status code 500
The provided future might be completed by the WebSocket itself, e.g calling the close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method
will try to accept the handshake and close the WebSocket afterward. |
Single<Integer> |
rxSetHandshake(Single<Integer> future)
Set an asynchronous result for the handshake, upon completion of the specified
future, the
WebSocket will either be
accepted when the future succeeds with the HTTP status code
rejected when the future is succeeds with an HTTP status code different than
rejected when the future fails with the HTTP status code 500
The provided future might be completed by the WebSocket itself, e.g calling the close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method
will try to accept the handshake and close the WebSocket afterward. |
Completable |
rxWrite(Buffer data)
Same as but with an
handler called when the operation completes |
Completable |
rxWriteBinaryMessage(Buffer data)
Same as
WebSocketBase.writeBinaryMessage(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Completable |
rxWriteFinalBinaryFrame(Buffer data)
Same as
WebSocketBase.writeFinalBinaryFrame(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Completable |
rxWriteFinalTextFrame(String text)
Same as
WebSocketBase.writeFinalTextFrame(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Completable |
rxWriteFrame(WebSocketFrame frame)
Same as
WebSocketBase.writeFrame(io.vertx.reactivex.core.http.WebSocketFrame, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Completable |
rxWritePing(Buffer data)
Writes a ping frame to the connection.
|
Completable |
rxWritePong(Buffer data)
Writes a pong frame to the connection.
|
Completable |
rxWriteTextMessage(String text)
Same as
WebSocketBase.writeTextMessage(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
String |
scheme() |
void |
setHandshake(Future<Integer> future)
Set an asynchronous result for the handshake, upon completion of the specified
future, the
WebSocket will either be
accepted when the future succeeds with the HTTP status code
rejected when the future is succeeds with an HTTP status code different than
rejected when the future fails with the HTTP status code 500
The provided future might be completed by the WebSocket itself, e.g calling the close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method
will try to accept the handshake and close the WebSocket afterward. |
void |
setHandshake(Future<Integer> future,
Handler<AsyncResult<Integer>> handler)
Set an asynchronous result for the handshake, upon completion of the specified
future, the
WebSocket will either be
accepted when the future succeeds with the HTTP status code
rejected when the future is succeeds with an HTTP status code different than
rejected when the future fails with the HTTP status code 500
The provided future might be completed by the WebSocket itself, e.g calling the close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method
will try to accept the handshake and close the WebSocket afterward. |
void |
setHandshake(Single<Integer> future)
Set an asynchronous result for the handshake, upon completion of the specified
future, the
WebSocket will either be
accepted when the future succeeds with the HTTP status code
rejected when the future is succeeds with an HTTP status code different than
rejected when the future fails with the HTTP status code 500
The provided future might be completed by the WebSocket itself, e.g calling the close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method
will try to accept the handshake and close the WebSocket afterward. |
void |
setHandshake(Single<Integer> future,
Handler<AsyncResult<Integer>> handler)
Set an asynchronous result for the handshake, upon completion of the specified
future, the
WebSocket will either be
accepted when the future succeeds with the HTTP status code
rejected when the future is succeeds with an HTTP status code different than
rejected when the future fails with the HTTP status code 500
The provided future might be completed by the WebSocket itself, e.g calling the close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method
will try to accept the handshake and close the WebSocket afterward. |
ServerWebSocket |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize. |
SSLSession |
sslSession() |
String |
subProtocol()
Returns the WebSocket sub protocol selected by the WebSocket handshake.
|
String |
textHandlerID()
When a
WebSocket is created, it may register an event handler with the eventbus, the ID of that
handler is given by textHandlerID. |
WebSocketBase |
textMessageHandler(Handler<String> handler)
Set a text message handler on the connection.
|
Flowable<Buffer> |
toFlowable() |
Observable<Buffer> |
toObservable() |
WriteStreamObserver<Buffer> |
toObserver() |
String |
toString() |
WriteStreamSubscriber<Buffer> |
toSubscriber() |
String |
uri() |
void |
write(Buffer data)
Same as but with an
handler called when the operation completes |
void |
write(Buffer data,
Handler<AsyncResult<Void>> handler)
Same as but with an
handler called when the operation completes |
ServerWebSocket |
writeBinaryMessage(Buffer data)
Same as
WebSocketBase.writeBinaryMessage(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
ServerWebSocket |
writeBinaryMessage(Buffer data,
Handler<AsyncResult<Void>> handler)
Same as
WebSocketBase.writeBinaryMessage(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
ServerWebSocket |
writeFinalBinaryFrame(Buffer data)
Same as
WebSocketBase.writeFinalBinaryFrame(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
ServerWebSocket |
writeFinalBinaryFrame(Buffer data,
Handler<AsyncResult<Void>> handler)
Same as
WebSocketBase.writeFinalBinaryFrame(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
ServerWebSocket |
writeFinalTextFrame(String text)
Same as
WebSocketBase.writeFinalTextFrame(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
ServerWebSocket |
writeFinalTextFrame(String text,
Handler<AsyncResult<Void>> handler)
Same as
WebSocketBase.writeFinalTextFrame(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
ServerWebSocket |
writeFrame(WebSocketFrame frame)
Same as
WebSocketBase.writeFrame(io.vertx.reactivex.core.http.WebSocketFrame, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
ServerWebSocket |
writeFrame(WebSocketFrame frame,
Handler<AsyncResult<Void>> handler)
Same as
WebSocketBase.writeFrame(io.vertx.reactivex.core.http.WebSocketFrame, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
WebSocketBase |
writePing(Buffer data)
Writes a ping frame to the connection.
|
WebSocketBase |
writePing(Buffer data,
Handler<AsyncResult<Void>> handler)
Writes a ping frame to the connection.
|
WebSocketBase |
writePong(Buffer data)
Writes a pong frame to the connection.
|
WebSocketBase |
writePong(Buffer data,
Handler<AsyncResult<Void>> handler)
Writes a pong frame to the connection.
|
boolean |
writeQueueFull()
This will return
true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize(int) |
ServerWebSocket |
writeTextMessage(String text)
Same as
WebSocketBase.writeTextMessage(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
ServerWebSocket |
writeTextMessage(String text,
Handler<AsyncResult<Void>> handler)
Same as
WebSocketBase.writeTextMessage(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitnewInstancenewInstance, newInstancenewInstance, newInstancenewInstancepublic static final io.vertx.lang.rx.TypeArg<ServerWebSocket> __TYPE_ARG
public ServerWebSocket(ServerWebSocket delegate)
public ServerWebSocket(Object delegate)
public ServerWebSocket getDelegate()
getDelegate in interface WebSocketBasegetDelegate in interface ReadStream<Buffer>getDelegate in interface StreamBasegetDelegate in interface WriteStream<Buffer>public Observable<Buffer> toObservable()
toObservable in interface ReadStream<Buffer>public Flowable<Buffer> toFlowable()
toFlowable in interface ReadStream<Buffer>public WriteStreamObserver<Buffer> toObserver()
public WriteStreamSubscriber<Buffer> toSubscriber()
public void write(Buffer data, Handler<AsyncResult<Void>> handler)
handler called when the operation completeswrite in interface WebSocketBasewrite in interface WriteStream<Buffer>data - handler - public void write(Buffer data)
handler called when the operation completeswrite in interface WebSocketBasewrite in interface WriteStream<Buffer>data - public Completable rxWrite(Buffer data)
handler called when the operation completesrxWrite in interface WebSocketBaserxWrite in interface WriteStream<Buffer>data - public void end(Buffer data, Handler<AsyncResult<Void>> handler)
handler called when the operation completesend in interface WebSocketBaseend in interface WriteStream<Buffer>data - handler - public void end(Buffer data)
handler called when the operation completesend in interface WebSocketBaseend in interface WriteStream<Buffer>data - public Completable rxEnd(Buffer data)
handler called when the operation completesrxEnd in interface WebSocketBaserxEnd in interface WriteStream<Buffer>data - public boolean writeQueueFull()
true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize(int)writeQueueFull in interface WebSocketBasewriteQueueFull in interface WriteStream<Buffer>true if write queue is fullpublic Pipe<Buffer> pipe()
WriteStream.pipe in interface WebSocketBasepipe in interface ReadStream<Buffer>public void pipeTo(WriteStream<Buffer> dst, Handler<AsyncResult<Void>> handler)
ReadStream to the WriteStream.
Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the handler will be
called with the result.
pipeTo in interface WebSocketBasepipeTo in interface ReadStream<Buffer>dst - the destination write streamhandler - public void pipeTo(WriteStream<Buffer> dst)
ReadStream to the WriteStream.
Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the handler will be
called with the result.
pipeTo in interface WebSocketBasepipeTo in interface ReadStream<Buffer>dst - the destination write streampublic Completable rxPipeTo(WriteStream<Buffer> dst)
ReadStream to the WriteStream.
Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the handler will be
called with the result.
rxPipeTo in interface WebSocketBaserxPipeTo in interface ReadStream<Buffer>dst - the destination write streampublic String binaryHandlerID()
WebSocket is created, it may register an event handler with the event bus - the ID of that
handler is given by this method.
By default, no handler is registered, the feature must be enabled via WebSocketConnectOptions or HttpServerOptions.
Given this ID, a different event loop can send a binary frame to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying connection. This allows you to write data to other WebSockets which are owned by different event loops.
binaryHandlerID in interface WebSocketBasepublic String textHandlerID()
WebSocket is created, it may register an event handler with the eventbus, the ID of that
handler is given by textHandlerID.
By default, no handler is registered, the feature must be enabled via WebSocketConnectOptions or HttpServerOptions.
Given this ID, a different event loop can send a text frame to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying connection. This allows you to write data to other WebSockets which are owned by different event loops.
textHandlerID in interface WebSocketBasepublic String subProtocol()
null when the handler receives the WebSocket callback as the
handshake will not be completed yet.subProtocol in interface WebSocketBasepublic Short closeStatusCode()
null when not yet received.closeStatusCode in interface WebSocketBasepublic String closeReason()
null when not yet received.closeReason in interface WebSocketBasepublic MultiMap headers()
null on subsequent interactions.headers in interface WebSocketBasepublic WebSocketBase writePing(Buffer data, Handler<AsyncResult<Void>> handler)
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.
writePing in interface WebSocketBasedata - the data to write, may be at most 125 byteshandler - called when the ping frame has been successfully writtenpublic WebSocketBase writePing(Buffer data)
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.
writePing in interface WebSocketBasedata - the data to write, may be at most 125 bytespublic Completable rxWritePing(Buffer data)
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.
rxWritePing in interface WebSocketBasedata - the data to write, may be at most 125 bytespublic WebSocketBase writePong(Buffer data, Handler<AsyncResult<Void>> handler)
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.
writePong in interface WebSocketBasedata - the data to write, may be at most 125 byteshandler - called when the pong frame has been successfully writtenpublic WebSocketBase writePong(Buffer data)
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.
writePong in interface WebSocketBasedata - the data to write, may be at most 125 bytespublic Completable rxWritePong(Buffer data)
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.
rxWritePong in interface WebSocketBasedata - the data to write, may be at most 125 bytespublic WebSocketBase textMessageHandler(Handler<String> handler)
WebSocketBase.binaryMessageHandler(io.vertx.core.Handler<io.vertx.reactivex.core.buffer.Buffer>), but the buffer will be converted to a String firsttextMessageHandler in interface WebSocketBasehandler - the handlerpublic WebSocketBase binaryMessageHandler(Handler<Buffer> handler)
handler(io.vertx.core.Handler<io.vertx.reactivex.core.buffer.Buffer>)
except that if a message comes into the socket in multiple frames, the data from the frames will be aggregated
into a single buffer before calling the handler (using WebSocketFrame.isFinal() to find the boundaries).binaryMessageHandler in interface WebSocketBasehandler - the handlerpublic WebSocketBase pongHandler(Handler<Buffer> handler)
Pong frames may be at most 125 bytes (octets).
There is no ping handler since ping frames should immediately be responded to with a pong frame with identical content
Pong frames may be received unsolicited.
pongHandler in interface WebSocketBasehandler - the handlerpublic void end(Handler<AsyncResult<Void>> handler)
end in interface WebSocketBaseend in interface WriteStream<Buffer>handler - public void end()
end in interface WebSocketBaseend in interface WriteStream<Buffer>public Completable rxEnd()
rxEnd in interface WebSocketBaserxEnd in interface WriteStream<Buffer>public void close(Handler<AsyncResult<Void>> handler)
close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesclose in interface WebSocketBasehandler - public void close()
close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesclose in interface WebSocketBasepublic Completable rxClose()
close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesrxClose in interface WebSocketBasepublic void close(short statusCode,
Handler<AsyncResult<Void>> handler)
WebSocketBase.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesclose in interface WebSocketBasestatusCode - handler - public void close(short statusCode)
WebSocketBase.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesclose in interface WebSocketBasestatusCode - public Completable rxClose(short statusCode)
WebSocketBase.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesrxClose in interface WebSocketBasestatusCode - public void close(short statusCode,
String reason,
Handler<AsyncResult<Void>> handler)
WebSocketBase.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesclose in interface WebSocketBasestatusCode - reason - handler - public void close(short statusCode,
String reason)
WebSocketBase.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesclose in interface WebSocketBasestatusCode - reason - public Completable rxClose(short statusCode, String reason)
WebSocketBase.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesrxClose in interface WebSocketBasestatusCode - reason - public SocketAddress remoteAddress()
remoteAddress in interface WebSocketBasenull (e.g a server bound on a domain socket). If useProxyProtocol is set to true, the address returned will be of the actual connecting client.public SocketAddress localAddress()
localAddress in interface WebSocketBasenull (e.g a server bound on a domain socket) If useProxyProtocol is set to true, the address returned will be of the proxy.public boolean isSsl()
isSsl in interface WebSocketBaseHttpConnection is encrypted via SSL/TLS.public boolean isClosed()
isClosed in interface WebSocketBasetrue if the WebSocket is closedpublic ServerWebSocket exceptionHandler(Handler<Throwable> handler)
ReadStreamexceptionHandler in interface WebSocketBaseexceptionHandler in interface ReadStream<Buffer>exceptionHandler in interface StreamBaseexceptionHandler in interface WriteStream<Buffer>handler - the exception handlerpublic ServerWebSocket handler(Handler<Buffer> handler)
ReadStreamhandler in interface WebSocketBasehandler in interface ReadStream<Buffer>public ServerWebSocket pause()
ReadStreamReadStream, 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.
pause in interface WebSocketBasepause in interface ReadStream<Buffer>public ServerWebSocket resume()
ReadStreamflowing mode.
If the ReadStream has been paused, reading will recommence on it.resume in interface WebSocketBaseresume in interface ReadStream<Buffer>public ServerWebSocket fetch(long amount)
ReadStreamamount 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.fetch in interface WebSocketBasefetch in interface ReadStream<Buffer>public ServerWebSocket endHandler(Handler<Void> endHandler)
ReadStreamendHandler in interface WebSocketBaseendHandler in interface ReadStream<Buffer>public ServerWebSocket setWriteQueueMaxSize(int maxSize)
WriteStreammaxSize. 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
NetSocket, etc...setWriteQueueMaxSize in interface WebSocketBasesetWriteQueueMaxSize in interface WriteStream<Buffer>maxSize - the max size of the write streampublic ServerWebSocket drainHandler(Handler<Void> handler)
WriteStreamPipe for an example of this being used.
The stream implementation defines when the drain handler, for example it could be when the queue size has been
reduced to maxSize / 2.
drainHandler in interface WebSocketBasedrainHandler in interface WriteStream<Buffer>handler - the handlerpublic ServerWebSocket writeFrame(WebSocketFrame frame, Handler<AsyncResult<Void>> handler)
WebSocketBaseWebSocketBase.writeFrame(io.vertx.reactivex.core.http.WebSocketFrame, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completeswriteFrame in interface WebSocketBasepublic ServerWebSocket writeFrame(WebSocketFrame frame)
WebSocketBaseWebSocketBase.writeFrame(io.vertx.reactivex.core.http.WebSocketFrame, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completeswriteFrame in interface WebSocketBasepublic Completable rxWriteFrame(WebSocketFrame frame)
WebSocketBaseWebSocketBase.writeFrame(io.vertx.reactivex.core.http.WebSocketFrame, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesrxWriteFrame in interface WebSocketBasepublic ServerWebSocket writeFinalTextFrame(String text, Handler<AsyncResult<Void>> handler)
WebSocketBaseWebSocketBase.writeFinalTextFrame(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completeswriteFinalTextFrame in interface WebSocketBasepublic ServerWebSocket writeFinalTextFrame(String text)
WebSocketBaseWebSocketBase.writeFinalTextFrame(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completeswriteFinalTextFrame in interface WebSocketBasepublic Completable rxWriteFinalTextFrame(String text)
WebSocketBaseWebSocketBase.writeFinalTextFrame(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesrxWriteFinalTextFrame in interface WebSocketBasepublic ServerWebSocket writeFinalBinaryFrame(Buffer data, Handler<AsyncResult<Void>> handler)
WebSocketBaseWebSocketBase.writeFinalBinaryFrame(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completeswriteFinalBinaryFrame in interface WebSocketBasepublic ServerWebSocket writeFinalBinaryFrame(Buffer data)
WebSocketBaseWebSocketBase.writeFinalBinaryFrame(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completeswriteFinalBinaryFrame in interface WebSocketBasepublic Completable rxWriteFinalBinaryFrame(Buffer data)
WebSocketBaseWebSocketBase.writeFinalBinaryFrame(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesrxWriteFinalBinaryFrame in interface WebSocketBasepublic ServerWebSocket writeBinaryMessage(Buffer data, Handler<AsyncResult<Void>> handler)
WebSocketBaseWebSocketBase.writeBinaryMessage(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completeswriteBinaryMessage in interface WebSocketBasepublic ServerWebSocket writeBinaryMessage(Buffer data)
WebSocketBaseWebSocketBase.writeBinaryMessage(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completeswriteBinaryMessage in interface WebSocketBasepublic Completable rxWriteBinaryMessage(Buffer data)
WebSocketBaseWebSocketBase.writeBinaryMessage(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesrxWriteBinaryMessage in interface WebSocketBasepublic ServerWebSocket writeTextMessage(String text, Handler<AsyncResult<Void>> handler)
WebSocketBaseWebSocketBase.writeTextMessage(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completeswriteTextMessage in interface WebSocketBasepublic ServerWebSocket writeTextMessage(String text)
WebSocketBaseWebSocketBase.writeTextMessage(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completeswriteTextMessage in interface WebSocketBasepublic Completable rxWriteTextMessage(String text)
WebSocketBaseWebSocketBase.writeTextMessage(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesrxWriteTextMessage in interface WebSocketBasepublic ServerWebSocket closeHandler(Handler<Void> handler)
WebSocketBaseWebSocketBase.closeStatusCode() will return the status code and WebSocketBase.closeReason() will return the reason.closeHandler in interface WebSocketBasehandler - the handlerpublic ServerWebSocket frameHandler(Handler<WebSocketFrame> handler)
WebSocketBaseframeHandler in interface WebSocketBasehandler - the handlerpublic String scheme()
public String host()
public String uri()
public String path()
public String query()
public void accept()
public void reject()
Calling this method from the WebSocket handler when it is first passed to you gives you the opportunity to reject the WebSocket, which will cause the WebSocket handshake to fail by returning a response code.
You might use this method, if for example you only want to accept WebSockets with a particular path.
public void reject(int status)
reject() but with a status.status - public void setHandshake(Future<Integer> future, Handler<AsyncResult<Integer>> handler)
future, the
WebSocket will either be
future succeeds with the HTTP status codefuture is succeeds with an HTTP status code different than future fails with the HTTP status code 500close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method
will try to accept the handshake and close the WebSocket afterward. Thus it is advised to try to complete
the future with or .
This method should be called from the WebSocket handler to explicitly set an asynchronous handshake.
Calling this method will override the future completion handler.
future - the future to complete withhandler - the completion handlerpublic void setHandshake(Future<Integer> future)
future, the
WebSocket will either be
future succeeds with the HTTP status codefuture is succeeds with an HTTP status code different than future fails with the HTTP status code 500close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method
will try to accept the handshake and close the WebSocket afterward. Thus it is advised to try to complete
the future with or .
This method should be called from the WebSocket handler to explicitly set an asynchronous handshake.
Calling this method will override the future completion handler.
future - the future to complete withpublic Single<Integer> rxSetHandshake(Future<Integer> future)
future, the
WebSocket will either be
future succeeds with the HTTP status codefuture is succeeds with an HTTP status code different than future fails with the HTTP status code 500close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method
will try to accept the handshake and close the WebSocket afterward. Thus it is advised to try to complete
the future with or .
This method should be called from the WebSocket handler to explicitly set an asynchronous handshake.
Calling this method will override the future completion handler.
future - the future to complete withpublic void setHandshake(Single<Integer> future, Handler<AsyncResult<Integer>> handler)
future, the
WebSocket will either be
future succeeds with the HTTP status codefuture is succeeds with an HTTP status code different than future fails with the HTTP status code 500close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method
will try to accept the handshake and close the WebSocket afterward. Thus it is advised to try to complete
the future with or .
This method should be called from the WebSocket handler to explicitly set an asynchronous handshake.
Calling this method will override the future completion handler.
future - the future to complete withhandler - the completion handlerpublic void setHandshake(Single<Integer> future)
future, the
WebSocket will either be
future succeeds with the HTTP status codefuture is succeeds with an HTTP status code different than future fails with the HTTP status code 500close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method
will try to accept the handshake and close the WebSocket afterward. Thus it is advised to try to complete
the future with or .
This method should be called from the WebSocket handler to explicitly set an asynchronous handshake.
Calling this method will override the future completion handler.
future - the future to complete withpublic Single<Integer> rxSetHandshake(Single<Integer> future)
future, the
WebSocket will either be
future succeeds with the HTTP status codefuture is succeeds with an HTTP status code different than future fails with the HTTP status code 500close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method
will try to accept the handshake and close the WebSocket afterward. Thus it is advised to try to complete
the future with or .
This method should be called from the WebSocket handler to explicitly set an asynchronous handshake.
Calling this method will override the future completion handler.
future - the future to complete withpublic SSLSession sslSession()
public static ServerWebSocket newInstance(ServerWebSocket arg)
Copyright © 2023 Eclipse. All rights reserved.