Class WebSocket
- java.lang.Object
-
- io.vertx.mutiny.core.http.WebSocket
-
- All Implemented Interfaces:
WebSocketBase
,ReadStream<Buffer>
,StreamBase
,WriteStream<Buffer>
public class WebSocket extends Object implements WebSocketBase
Represents a client-side WebSocket. NOTE: This class has been automatically generated from theoriginal
non Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<WebSocket>
__TYPE_ARG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
binaryHandlerID()
WebSocketBase
binaryMessageHandler(Consumer<Buffer> handler)
io.smallrye.mutiny.Uni<Void>
close()
Same asWebSocketBase.close()
but with anhandler
called when the operation completesio.smallrye.mutiny.Uni<Void>
close(short statusCode)
Same asWebSocketBase.close()
but with anhandler
called when the operation completesio.smallrye.mutiny.Uni<Void>
close(short statusCode, String reason)
Same asWebSocketBase.close()
but with anhandler
called when the operation completesVoid
closeAndAwait()
Blocking variant ofWebSocketBase.close()
.Void
closeAndAwait(short statusCode)
Blocking variant ofWebSocketBase.close(short)
.Void
closeAndAwait(short statusCode, String reason)
Blocking variant ofWebSocketBase.close(short,String)
.void
closeAndForget()
Variant ofWebSocketBase.close()
that ignores the result of the operation.void
closeAndForget(short statusCode)
Variant ofWebSocketBase.close(short)
that ignores the result of the operation.void
closeAndForget(short statusCode, String reason)
Variant ofWebSocketBase.close(short,String)
that ignores the result of the operation.WebSocket
closeHandler(Runnable handler)
String
closeReason()
Short
closeStatusCode()
WebSocket
drainHandler(Runnable handler)
io.smallrye.mutiny.Uni<Void>
end()
CallsWebSocketBase.close()
io.smallrye.mutiny.Uni<Void>
end(Buffer data)
Same as but with anhandler
called when the operation completesVoid
endAndAwait()
Blocking variant ofWebSocketBase.end(io.vertx.mutiny.core.buffer.Buffer)
.Void
endAndAwait(Buffer data)
Blocking variant ofio.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer)
.void
endAndForget()
Variant ofWebSocketBase.end(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.void
endAndForget(Buffer data)
Variant ofio.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.WebSocket
endHandler(Runnable endHandler)
boolean
equals(Object o)
WebSocket
exceptionHandler(Consumer<Throwable> handler)
WebSocket
fetch(long amount)
WebSocket
frameHandler(Consumer<WebSocketFrame> handler)
io.vertx.core.http.WebSocket
getDelegate()
WebSocket
handler(Consumer<Buffer> handler)
int
hashCode()
MultiMap
headers()
boolean
isClosed()
boolean
isSsl()
SocketAddress
localAddress()
static WebSocket
newInstance(io.vertx.core.http.WebSocket arg)
WebSocket
pause()
Pipe<Buffer>
pipe()
io.smallrye.mutiny.Uni<Void>
pipeTo(WriteStream<Buffer> dst)
Pipe thisReadStream
to theWriteStream
.Void
pipeToAndAwait(WriteStream<Buffer> dst)
Blocking variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream
.) void
pipeToAndForget(WriteStream<Buffer> dst)
Variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream
that ignores the result of the operation.) WebSocketBase
pongHandler(Consumer<Buffer> handler)
SocketAddress
remoteAddress()
WebSocket
resume()
WebSocket
setWriteQueueMaxSize(int maxSize)
SSLSession
sslSession()
String
subProtocol()
String
textHandlerID()
WebSocketBase
textMessageHandler(Consumer<String> handler)
Iterable<Buffer>
toBlockingIterable()
Stream<Buffer>
toBlockingStream()
io.smallrye.mutiny.Multi<Buffer>
toMulti()
String
toString()
WriteStreamSubscriber<Buffer>
toSubscriber()
io.smallrye.mutiny.Uni<Void>
write(Buffer data)
Same as but with anhandler
called when the operation completesVoid
writeAndAwait(Buffer data)
Blocking variant ofio.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer)
.void
writeAndForget(Buffer data)
Variant ofio.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
writeBinaryMessage(Buffer data)
Same asWebSocketBase.writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer)
but with anhandler
called when the operation completesVoid
writeBinaryMessageAndAwait(Buffer data)
Blocking variant ofWebSocketBase.writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer)
.WebSocket
writeBinaryMessageAndForget(Buffer data)
Variant ofWebSocketBase.writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
writeFinalBinaryFrame(Buffer data)
Same asWebSocketBase.writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer)
but with anhandler
called when the operation completesVoid
writeFinalBinaryFrameAndAwait(Buffer data)
Blocking variant ofWebSocketBase.writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer)
.WebSocket
writeFinalBinaryFrameAndForget(Buffer data)
Variant ofWebSocketBase.writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
writeFinalTextFrame(String text)
Same asWebSocketBase.writeFinalTextFrame(java.lang.String)
but with anhandler
called when the operation completesVoid
writeFinalTextFrameAndAwait(String text)
Blocking variant ofWebSocketBase.writeFinalTextFrame(String)
.WebSocket
writeFinalTextFrameAndForget(String text)
Variant ofWebSocketBase.writeFinalTextFrame(String)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
writeFrame(WebSocketFrame frame)
Same asWebSocketBase.writeFrame(io.vertx.mutiny.core.http.WebSocketFrame)
but with anhandler
called when the operation completesVoid
writeFrameAndAwait(WebSocketFrame frame)
Blocking variant ofWebSocketBase.writeFrame(io.vertx.mutiny.core.http.WebSocketFrame)
.WebSocket
writeFrameAndForget(WebSocketFrame frame)
Variant ofWebSocketBase.writeFrame(io.vertx.mutiny.core.http.WebSocketFrame)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
writePing(Buffer data)
Writes a ping frame to the connection.Void
writePingAndAwait(Buffer data)
Blocking variant ofWebSocketBase.writePing(io.vertx.mutiny.core.buffer.Buffer)
.WebSocketBase
writePingAndForget(Buffer data)
Variant ofWebSocketBase.writePing(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
writePong(Buffer data)
Writes a pong frame to the connection.Void
writePongAndAwait(Buffer data)
Blocking variant ofWebSocketBase.writePong(io.vertx.mutiny.core.buffer.Buffer)
.WebSocketBase
writePongAndForget(Buffer data)
Variant ofWebSocketBase.writePong(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.boolean
writeQueueFull()
io.smallrye.mutiny.Uni<Void>
writeTextMessage(String text)
Same asWebSocketBase.writeTextMessage(java.lang.String)
but with anhandler
called when the operation completesVoid
writeTextMessageAndAwait(String text)
Blocking variant ofWebSocketBase.writeTextMessage(String)
.WebSocket
writeTextMessageAndForget(String text)
Variant ofWebSocketBase.writeTextMessage(String)
that ignores the result of the operation.
-
-
-
Constructor Detail
-
WebSocket
public WebSocket(io.vertx.core.http.WebSocket delegate)
-
WebSocket
public WebSocket(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.core.http.WebSocket getDelegate()
- Specified by:
getDelegate
in interfaceReadStream<Buffer>
- Specified by:
getDelegate
in interfaceStreamBase
- Specified by:
getDelegate
in interfaceWebSocketBase
- Specified by:
getDelegate
in interfaceWriteStream<Buffer>
-
toSubscriber
public WriteStreamSubscriber<Buffer> toSubscriber()
-
pipe
public Pipe<Buffer> pipe()
- Specified by:
pipe
in interfaceReadStream<Buffer>
- Specified by:
pipe
in interfaceWebSocketBase
- Returns:
- a pipe
-
pipeTo
public io.smallrye.mutiny.Uni<Void> pipeTo(WriteStream<Buffer> dst)
Pipe thisReadStream
to theWriteStream
.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.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
pipeTo
in interfaceReadStream<Buffer>
- Specified by:
pipeTo
in interfaceWebSocketBase
- Parameters:
dst
- the destination write stream- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
pipeToAndAwait
public Void pipeToAndAwait(WriteStream<Buffer> dst)
Blocking variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream
.) This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
pipeToAndAwait
in interfaceReadStream<Buffer>
- Specified by:
pipeToAndAwait
in interfaceWebSocketBase
- Parameters:
dst
- the destination write stream- Returns:
- the Void instance produced by the operation.
-
pipeToAndForget
public void pipeToAndForget(WriteStream<Buffer> dst)
Variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream
that ignores the result of the operation.) This method subscribes on the result of
io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from) io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream
but you don't need to compose it with other operations.) - Specified by:
pipeToAndForget
in interfaceReadStream<Buffer>
- Specified by:
pipeToAndForget
in interfaceWebSocketBase
- Parameters:
dst
- the destination write stream
-
write
public io.smallrye.mutiny.Uni<Void> write(Buffer data)
Same as but with anhandler
called when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
write
in interfaceWebSocketBase
- Specified by:
write
in interfaceWriteStream<Buffer>
- Parameters:
data
-- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
writeAndAwait
public Void writeAndAwait(Buffer data)
Blocking variant ofio.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
writeAndAwait
in interfaceWebSocketBase
- Specified by:
writeAndAwait
in interfaceWriteStream<Buffer>
- Parameters:
data
-- Returns:
- the Void instance produced by the operation.
-
writeAndForget
public void writeAndForget(Buffer data)
Variant ofio.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.This method subscribes on the result of
io.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromio.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer)
but you don't need to compose it with other operations.- Specified by:
writeAndForget
in interfaceWebSocketBase
- Specified by:
writeAndForget
in interfaceWriteStream<Buffer>
- Parameters:
data
-
-
end
public io.smallrye.mutiny.Uni<Void> end(Buffer data)
Same as but with anhandler
called when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
end
in interfaceWebSocketBase
- Specified by:
end
in interfaceWriteStream<Buffer>
- Parameters:
data
-- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
endAndAwait
public Void endAndAwait(Buffer data)
Blocking variant ofio.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
endAndAwait
in interfaceWebSocketBase
- Specified by:
endAndAwait
in interfaceWriteStream<Buffer>
- Parameters:
data
-- Returns:
- the Void instance produced by the operation.
-
endAndForget
public void endAndForget(Buffer data)
Variant ofio.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.This method subscribes on the result of
io.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromio.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer)
but you don't need to compose it with other operations.- Specified by:
endAndForget
in interfaceWebSocketBase
- Specified by:
endAndForget
in interfaceWriteStream<Buffer>
- Parameters:
data
-
-
writeQueueFull
public boolean writeQueueFull()
- Specified by:
writeQueueFull
in interfaceWebSocketBase
- Specified by:
writeQueueFull
in interfaceWriteStream<Buffer>
- Returns:
true
if write queue is full
-
binaryHandlerID
public String binaryHandlerID()
- Specified by:
binaryHandlerID
in interfaceWebSocketBase
- Returns:
- the binary handler id
-
textHandlerID
public String textHandlerID()
- Specified by:
textHandlerID
in interfaceWebSocketBase
- Returns:
-
subProtocol
public String subProtocol()
- Specified by:
subProtocol
in interfaceWebSocketBase
- Returns:
-
closeStatusCode
public Short closeStatusCode()
- Specified by:
closeStatusCode
in interfaceWebSocketBase
- Returns:
-
closeReason
public String closeReason()
- Specified by:
closeReason
in interfaceWebSocketBase
- Returns:
-
headers
public MultiMap headers()
- Specified by:
headers
in interfaceWebSocketBase
- Returns:
- the headers
-
writePing
public io.smallrye.mutiny.Uni<Void> writePing(Buffer data)
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.
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
writePing
in interfaceWebSocketBase
- Parameters:
data
- the data to write, may be at most 125 bytes- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
writePingAndAwait
public Void writePingAndAwait(Buffer data)
Blocking variant ofWebSocketBase.writePing(io.vertx.mutiny.core.buffer.Buffer)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
writePingAndAwait
in interfaceWebSocketBase
- Parameters:
data
- the data to write, may be at most 125 bytes- Returns:
- the Void instance produced by the operation.
-
writePingAndForget
public WebSocketBase writePingAndForget(Buffer data)
Variant ofWebSocketBase.writePing(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.This method subscribes on the result of
WebSocketBase.writePing(io.vertx.mutiny.core.buffer.Buffer)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromWebSocketBase.writePing(io.vertx.mutiny.core.buffer.Buffer)
but you don't need to compose it with other operations.- Specified by:
writePingAndForget
in interfaceWebSocketBase
- Parameters:
data
- the data to write, may be at most 125 bytes- Returns:
- the instance of WebSocketBase to chain method calls.
-
writePong
public io.smallrye.mutiny.Uni<Void> writePong(Buffer data)
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.
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
writePong
in interfaceWebSocketBase
- Parameters:
data
- the data to write, may be at most 125 bytes- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
writePongAndAwait
public Void writePongAndAwait(Buffer data)
Blocking variant ofWebSocketBase.writePong(io.vertx.mutiny.core.buffer.Buffer)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
writePongAndAwait
in interfaceWebSocketBase
- Parameters:
data
- the data to write, may be at most 125 bytes- Returns:
- the Void instance produced by the operation.
-
writePongAndForget
public WebSocketBase writePongAndForget(Buffer data)
Variant ofWebSocketBase.writePong(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.This method subscribes on the result of
WebSocketBase.writePong(io.vertx.mutiny.core.buffer.Buffer)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromWebSocketBase.writePong(io.vertx.mutiny.core.buffer.Buffer)
but you don't need to compose it with other operations.- Specified by:
writePongAndForget
in interfaceWebSocketBase
- Parameters:
data
- the data to write, may be at most 125 bytes- Returns:
- the instance of WebSocketBase to chain method calls.
-
textMessageHandler
public WebSocketBase textMessageHandler(Consumer<String> handler)
- Specified by:
textMessageHandler
in interfaceWebSocketBase
- Parameters:
handler
- the handler- Returns:
-
binaryMessageHandler
public WebSocketBase binaryMessageHandler(Consumer<Buffer> handler)
- Specified by:
binaryMessageHandler
in interfaceWebSocketBase
- Parameters:
handler
- the handler- Returns:
-
pongHandler
public WebSocketBase pongHandler(Consumer<Buffer> handler)
- Specified by:
pongHandler
in interfaceWebSocketBase
- Parameters:
handler
- the handler- Returns:
-
end
public io.smallrye.mutiny.Uni<Void> end()
CallsWebSocketBase.close()
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
end
in interfaceWebSocketBase
- Specified by:
end
in interfaceWriteStream<Buffer>
- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
endAndAwait
public Void endAndAwait()
Blocking variant ofWebSocketBase.end(io.vertx.mutiny.core.buffer.Buffer)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
endAndAwait
in interfaceWebSocketBase
- Specified by:
endAndAwait
in interfaceWriteStream<Buffer>
- Returns:
- the Void instance produced by the operation.
-
endAndForget
public void endAndForget()
Variant ofWebSocketBase.end(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.This method subscribes on the result of
WebSocketBase.end(io.vertx.mutiny.core.buffer.Buffer)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromWebSocketBase.end(io.vertx.mutiny.core.buffer.Buffer)
but you don't need to compose it with other operations.- Specified by:
endAndForget
in interfaceWebSocketBase
- Specified by:
endAndForget
in interfaceWriteStream<Buffer>
-
close
public io.smallrye.mutiny.Uni<Void> close()
Same asWebSocketBase.close()
but with anhandler
called when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
close
in interfaceWebSocketBase
- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
closeAndAwait
public Void closeAndAwait()
Blocking variant ofWebSocketBase.close()
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
closeAndAwait
in interfaceWebSocketBase
- Returns:
- the Void instance produced by the operation.
-
closeAndForget
public void closeAndForget()
Variant ofWebSocketBase.close()
that ignores the result of the operation.This method subscribes on the result of
WebSocketBase.close()
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromWebSocketBase.close()
but you don't need to compose it with other operations.- Specified by:
closeAndForget
in interfaceWebSocketBase
-
close
public io.smallrye.mutiny.Uni<Void> close(short statusCode)
Same asWebSocketBase.close()
but with anhandler
called when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
close
in interfaceWebSocketBase
- Parameters:
statusCode
-- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
closeAndAwait
public Void closeAndAwait(short statusCode)
Blocking variant ofWebSocketBase.close(short)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
closeAndAwait
in interfaceWebSocketBase
- Parameters:
statusCode
-- Returns:
- the Void instance produced by the operation.
-
closeAndForget
public void closeAndForget(short statusCode)
Variant ofWebSocketBase.close(short)
that ignores the result of the operation.This method subscribes on the result of
WebSocketBase.close(short)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromWebSocketBase.close(short)
but you don't need to compose it with other operations.- Specified by:
closeAndForget
in interfaceWebSocketBase
- Parameters:
statusCode
-
-
close
public io.smallrye.mutiny.Uni<Void> close(short statusCode, String reason)
Same asWebSocketBase.close()
but with anhandler
called when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
close
in interfaceWebSocketBase
- Parameters:
statusCode
-reason
-- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
closeAndAwait
public Void closeAndAwait(short statusCode, String reason)
Blocking variant ofWebSocketBase.close(short,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
closeAndAwait
in interfaceWebSocketBase
- Parameters:
statusCode
-reason
-- Returns:
- the Void instance produced by the operation.
-
closeAndForget
public void closeAndForget(short statusCode, String reason)
Variant ofWebSocketBase.close(short,String)
that ignores the result of the operation.This method subscribes on the result of
WebSocketBase.close(short,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromWebSocketBase.close(short,String)
but you don't need to compose it with other operations.- Specified by:
closeAndForget
in interfaceWebSocketBase
- Parameters:
statusCode
-reason
-
-
remoteAddress
public SocketAddress remoteAddress()
- Specified by:
remoteAddress
in interfaceWebSocketBase
- Returns:
- the remote address for this connection, possibly
null
(e.g a server bound on a domain socket). IfuseProxyProtocol
is set totrue
, the address returned will be of the actual connecting client.
-
localAddress
public SocketAddress localAddress()
- Specified by:
localAddress
in interfaceWebSocketBase
- Returns:
- the local address for this connection, possibly
null
(e.g a server bound on a domain socket) IfuseProxyProtocol
is set totrue
, the address returned will be of the proxy.
-
isSsl
public boolean isSsl()
- Specified by:
isSsl
in interfaceWebSocketBase
- Returns:
- true if this
HttpConnection
is encrypted via SSL/TLS.
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceWebSocketBase
- Returns:
true
if the WebSocket is closed
-
exceptionHandler
public WebSocket exceptionHandler(Consumer<Throwable> handler)
- Specified by:
exceptionHandler
in interfaceReadStream<Buffer>
- Specified by:
exceptionHandler
in interfaceStreamBase
- Specified by:
exceptionHandler
in interfaceWebSocketBase
- Specified by:
exceptionHandler
in interfaceWriteStream<Buffer>
- Parameters:
handler
- the exception handler- Returns:
-
handler
public WebSocket handler(Consumer<Buffer> handler)
- Specified by:
handler
in interfaceReadStream<Buffer>
- Specified by:
handler
in interfaceWebSocketBase
- Returns:
-
pause
public WebSocket pause()
- Specified by:
pause
in interfaceReadStream<Buffer>
- Specified by:
pause
in interfaceWebSocketBase
- Returns:
- a reference to this, so the API can be used fluently
-
resume
public WebSocket resume()
- Specified by:
resume
in interfaceReadStream<Buffer>
- Specified by:
resume
in interfaceWebSocketBase
- Returns:
- a reference to this, so the API can be used fluently
-
fetch
public WebSocket fetch(long amount)
- Specified by:
fetch
in interfaceReadStream<Buffer>
- Specified by:
fetch
in interfaceWebSocketBase
- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
public WebSocket endHandler(Runnable endHandler)
- Specified by:
endHandler
in interfaceReadStream<Buffer>
- Specified by:
endHandler
in interfaceWebSocketBase
- Returns:
-
setWriteQueueMaxSize
public WebSocket setWriteQueueMaxSize(int maxSize)
- Specified by:
setWriteQueueMaxSize
in interfaceWebSocketBase
- Specified by:
setWriteQueueMaxSize
in interfaceWriteStream<Buffer>
- Parameters:
maxSize
- the max size of the write stream- Returns:
- a reference to this, so the API can be used fluently
-
drainHandler
public WebSocket drainHandler(Runnable handler)
- Specified by:
drainHandler
in interfaceWebSocketBase
- Specified by:
drainHandler
in interfaceWriteStream<Buffer>
- Parameters:
handler
- the handler- Returns:
-
writeFrame
public io.smallrye.mutiny.Uni<Void> writeFrame(WebSocketFrame frame)
Description copied from interface:WebSocketBase
Same asWebSocketBase.writeFrame(io.vertx.mutiny.core.http.WebSocketFrame)
but with anhandler
called when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
writeFrame
in interfaceWebSocketBase
- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
writeFrameAndAwait
public Void writeFrameAndAwait(WebSocketFrame frame)
Description copied from interface:WebSocketBase
Blocking variant ofWebSocketBase.writeFrame(io.vertx.mutiny.core.http.WebSocketFrame)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
writeFrameAndAwait
in interfaceWebSocketBase
- Returns:
- the Void instance produced by the operation.
-
writeFrameAndForget
public WebSocket writeFrameAndForget(WebSocketFrame frame)
Description copied from interface:WebSocketBase
Variant ofWebSocketBase.writeFrame(io.vertx.mutiny.core.http.WebSocketFrame)
that ignores the result of the operation.This method subscribes on the result of
WebSocketBase.writeFrame(io.vertx.mutiny.core.http.WebSocketFrame)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromWebSocketBase.writeFrame(io.vertx.mutiny.core.http.WebSocketFrame)
but you don't need to compose it with other operations.- Specified by:
writeFrameAndForget
in interfaceWebSocketBase
- Returns:
- the instance of WebSocketBase to chain method calls.
-
writeFinalTextFrame
public io.smallrye.mutiny.Uni<Void> writeFinalTextFrame(String text)
Description copied from interface:WebSocketBase
Same asWebSocketBase.writeFinalTextFrame(java.lang.String)
but with anhandler
called when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
writeFinalTextFrame
in interfaceWebSocketBase
- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
writeFinalTextFrameAndAwait
public Void writeFinalTextFrameAndAwait(String text)
Description copied from interface:WebSocketBase
Blocking variant ofWebSocketBase.writeFinalTextFrame(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
writeFinalTextFrameAndAwait
in interfaceWebSocketBase
- Returns:
- the Void instance produced by the operation.
-
writeFinalTextFrameAndForget
public WebSocket writeFinalTextFrameAndForget(String text)
Description copied from interface:WebSocketBase
Variant ofWebSocketBase.writeFinalTextFrame(String)
that ignores the result of the operation.This method subscribes on the result of
WebSocketBase.writeFinalTextFrame(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromWebSocketBase.writeFinalTextFrame(String)
but you don't need to compose it with other operations.- Specified by:
writeFinalTextFrameAndForget
in interfaceWebSocketBase
- Returns:
- the instance of WebSocketBase to chain method calls.
-
writeFinalBinaryFrame
public io.smallrye.mutiny.Uni<Void> writeFinalBinaryFrame(Buffer data)
Description copied from interface:WebSocketBase
Same asWebSocketBase.writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer)
but with anhandler
called when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
writeFinalBinaryFrame
in interfaceWebSocketBase
- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
writeFinalBinaryFrameAndAwait
public Void writeFinalBinaryFrameAndAwait(Buffer data)
Description copied from interface:WebSocketBase
Blocking variant ofWebSocketBase.writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
writeFinalBinaryFrameAndAwait
in interfaceWebSocketBase
- Returns:
- the Void instance produced by the operation.
-
writeFinalBinaryFrameAndForget
public WebSocket writeFinalBinaryFrameAndForget(Buffer data)
Description copied from interface:WebSocketBase
Variant ofWebSocketBase.writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.This method subscribes on the result of
WebSocketBase.writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromWebSocketBase.writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer)
but you don't need to compose it with other operations.- Specified by:
writeFinalBinaryFrameAndForget
in interfaceWebSocketBase
- Returns:
- the instance of WebSocketBase to chain method calls.
-
writeBinaryMessage
public io.smallrye.mutiny.Uni<Void> writeBinaryMessage(Buffer data)
Description copied from interface:WebSocketBase
Same asWebSocketBase.writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer)
but with anhandler
called when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
writeBinaryMessage
in interfaceWebSocketBase
- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
writeBinaryMessageAndAwait
public Void writeBinaryMessageAndAwait(Buffer data)
Description copied from interface:WebSocketBase
Blocking variant ofWebSocketBase.writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
writeBinaryMessageAndAwait
in interfaceWebSocketBase
- Returns:
- the Void instance produced by the operation.
-
writeBinaryMessageAndForget
public WebSocket writeBinaryMessageAndForget(Buffer data)
Description copied from interface:WebSocketBase
Variant ofWebSocketBase.writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.This method subscribes on the result of
WebSocketBase.writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromWebSocketBase.writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer)
but you don't need to compose it with other operations.- Specified by:
writeBinaryMessageAndForget
in interfaceWebSocketBase
- Returns:
- the instance of WebSocketBase to chain method calls.
-
writeTextMessage
public io.smallrye.mutiny.Uni<Void> writeTextMessage(String text)
Description copied from interface:WebSocketBase
Same asWebSocketBase.writeTextMessage(java.lang.String)
but with anhandler
called when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
writeTextMessage
in interfaceWebSocketBase
- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
writeTextMessageAndAwait
public Void writeTextMessageAndAwait(String text)
Description copied from interface:WebSocketBase
Blocking variant ofWebSocketBase.writeTextMessage(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
writeTextMessageAndAwait
in interfaceWebSocketBase
- Returns:
- the Void instance produced by the operation.
-
writeTextMessageAndForget
public WebSocket writeTextMessageAndForget(String text)
Description copied from interface:WebSocketBase
Variant ofWebSocketBase.writeTextMessage(String)
that ignores the result of the operation.This method subscribes on the result of
WebSocketBase.writeTextMessage(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromWebSocketBase.writeTextMessage(String)
but you don't need to compose it with other operations.- Specified by:
writeTextMessageAndForget
in interfaceWebSocketBase
- Returns:
- the instance of WebSocketBase to chain method calls.
-
closeHandler
public WebSocket closeHandler(Runnable handler)
- Specified by:
closeHandler
in interfaceWebSocketBase
- Parameters:
handler
- the handler- Returns:
-
frameHandler
public WebSocket frameHandler(Consumer<WebSocketFrame> handler)
- Specified by:
frameHandler
in interfaceWebSocketBase
- Parameters:
handler
- the handler- Returns:
-
sslSession
public SSLSession sslSession()
- Specified by:
sslSession
in interfaceWebSocketBase
- Returns:
- SSLSession associated with the underlying socket. Returns null if connection is not SSL.
-
toMulti
public io.smallrye.mutiny.Multi<Buffer> toMulti()
- Specified by:
toMulti
in interfaceReadStream<Buffer>
-
newInstance
public static WebSocket newInstance(io.vertx.core.http.WebSocket arg)
-
-