Class ClientWebSocket
- java.lang.Object
-
- io.vertx.mutiny.core.http.WebSocket
-
- io.vertx.mutiny.core.http.ClientWebSocket
-
- All Implemented Interfaces:
WebSocketBase,ReadStream<Buffer>,StreamBase,WriteStream<Buffer>
public class ClientWebSocket extends WebSocket
Represents a client-side WebSocket initially not connected. NOTE: This class has been automatically generated from theoriginalnon Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<ClientWebSocket>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description ClientWebSocket(io.vertx.core.http.ClientWebSocket delegate)ClientWebSocket(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringbinaryHandlerID()ClientWebSocketbinaryMessageHandler(Consumer<Buffer> handler)io.smallrye.mutiny.Uni<Void>close()Same asWebSocketBase.close()but with anhandlercalled when the operation completesio.smallrye.mutiny.Uni<Void>close(short statusCode)Same asWebSocketBase.close()but with anhandlercalled when the operation completesio.smallrye.mutiny.Uni<Void>close(short statusCode, String reason)Same asWebSocketBase.close()but with anhandlercalled when the operation completesVoidcloseAndAwait()Blocking variant ofWebSocketBase.close().VoidcloseAndAwait(short statusCode)Blocking variant ofWebSocketBase.close(short).VoidcloseAndAwait(short statusCode, String reason)Blocking variant ofWebSocketBase.close(short,String).voidcloseAndForget()Variant ofWebSocketBase.close()that ignores the result of the operation.voidcloseAndForget(short statusCode)Variant ofWebSocketBase.close(short)that ignores the result of the operation.voidcloseAndForget(short statusCode, String reason)Variant ofWebSocketBase.close(short,String)that ignores the result of the operation.ClientWebSocketcloseHandler(Runnable handler)StringcloseReason()ShortcloseStatusCode()io.smallrye.mutiny.Uni<WebSocket>connect(int port, String host, String requestURI)Connect a WebSocket to the specified port, host and relative request URIio.smallrye.mutiny.Uni<WebSocket>connect(io.vertx.core.http.WebSocketConnectOptions options)Connect a WebSocket with the specified options.io.smallrye.mutiny.Uni<WebSocket>connect(String requestURI)Connect this WebSocket at the relative request URI using the default host and port.io.smallrye.mutiny.Uni<WebSocket>connect(String host, String requestURI)Connect this WebSocket to the host and relative request URI and default port.WebSocketconnectAndAwait(int port, String host, String requestURI)Blocking variant ofconnect(int,String,String).WebSocketconnectAndAwait(io.vertx.core.http.WebSocketConnectOptions options)Blocking variant ofconnect(WebSocketConnectOptions).WebSocketconnectAndAwait(String requestURI)Blocking variant ofconnect(String).WebSocketconnectAndAwait(String host, String requestURI)Blocking variant ofconnect(String,String).voidconnectAndForget(int port, String host, String requestURI)Variant ofconnect(int,String,String)that ignores the result of the operation.voidconnectAndForget(io.vertx.core.http.WebSocketConnectOptions options)Variant ofconnect(WebSocketConnectOptions)that ignores the result of the operation.voidconnectAndForget(String requestURI)Variant ofconnect(String)that ignores the result of the operation.voidconnectAndForget(String host, String requestURI)Variant ofconnect(String,String)that ignores the result of the operation.ClientWebSocketdrainHandler(Runnable handler)io.smallrye.mutiny.Uni<Void>end()CallsWebSocketBase.close()io.smallrye.mutiny.Uni<Void>end(Buffer data)Same as but with anhandlercalled when the operation completesVoidendAndAwait()Blocking variant ofWebSocketBase.end(io.vertx.mutiny.core.buffer.Buffer).VoidendAndAwait(Buffer data)Blocking variant ofio.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer).voidendAndForget()Variant ofWebSocketBase.end(io.vertx.mutiny.core.buffer.Buffer)that ignores the result of the operation.voidendAndForget(Buffer data)Variant ofio.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer)that ignores the result of the operation.ClientWebSocketendHandler(Runnable endHandler)booleanequals(Object o)ClientWebSocketexceptionHandler(Consumer<Throwable> handler)ClientWebSocketframeHandler(Consumer<WebSocketFrame> handler)io.vertx.core.http.ClientWebSocketgetDelegate()ClientWebSockethandler(Consumer<Buffer> handler)inthashCode()MultiMapheaders()booleanisClosed()booleanisSsl()SocketAddresslocalAddress()static ClientWebSocketnewInstance(io.vertx.core.http.ClientWebSocket arg)Pipe<Buffer>pipe()io.smallrye.mutiny.Uni<Void>pipeTo(WriteStream<Buffer> dst)Pipe thisReadStreamto theWriteStream.VoidpipeToAndAwait(WriteStream<Buffer> dst)Blocking variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream).voidpipeToAndForget(WriteStream<Buffer> dst)Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)that ignores the result of the operation.ClientWebSocketpongHandler(Consumer<Buffer> handler)SocketAddressremoteAddress()SSLSessionsslSession()StringsubProtocol()StringtextHandlerID()ClientWebSockettextMessageHandler(Consumer<String> handler)Iterable<Buffer>toBlockingIterable()Stream<Buffer>toBlockingStream()io.smallrye.mutiny.Multi<Buffer>toMulti()StringtoString()WriteStreamSubscriber<Buffer>toSubscriber()io.smallrye.mutiny.Uni<Void>write(Buffer data)Same as but with anhandlercalled when the operation completesVoidwriteAndAwait(Buffer data)Blocking variant ofio.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer).voidwriteAndForget(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 anhandlercalled when the operation completesVoidwriteBinaryMessageAndAwait(Buffer data)Blocking variant ofWebSocketBase.writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer).ClientWebSocketwriteBinaryMessageAndForget(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 anhandlercalled when the operation completesVoidwriteFinalBinaryFrameAndAwait(Buffer data)Blocking variant ofWebSocketBase.writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer).ClientWebSocketwriteFinalBinaryFrameAndForget(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 anhandlercalled when the operation completesVoidwriteFinalTextFrameAndAwait(String text)Blocking variant ofWebSocketBase.writeFinalTextFrame(String).ClientWebSocketwriteFinalTextFrameAndForget(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 anhandlercalled when the operation completesVoidwriteFrameAndAwait(WebSocketFrame frame)Blocking variant ofWebSocketBase.writeFrame(io.vertx.mutiny.core.http.WebSocketFrame).ClientWebSocketwriteFrameAndForget(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.VoidwritePingAndAwait(Buffer data)Blocking variant ofWebSocketBase.writePing(io.vertx.mutiny.core.buffer.Buffer).ClientWebSocketwritePingAndForget(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.VoidwritePongAndAwait(Buffer data)Blocking variant ofWebSocketBase.writePong(io.vertx.mutiny.core.buffer.Buffer).ClientWebSocketwritePongAndForget(Buffer data)Variant ofWebSocketBase.writePong(io.vertx.mutiny.core.buffer.Buffer)that ignores the result of the operation.booleanwriteQueueFull()io.smallrye.mutiny.Uni<Void>writeTextMessage(String text)Same asWebSocketBase.writeTextMessage(java.lang.String)but with anhandlercalled when the operation completesVoidwriteTextMessageAndAwait(String text)Blocking variant ofWebSocketBase.writeTextMessage(String).ClientWebSocketwriteTextMessageAndForget(String text)Variant ofWebSocketBase.writeTextMessage(String)that ignores the result of the operation.-
Methods inherited from class io.vertx.mutiny.core.http.WebSocket
fetch, newInstance, pause, resume, setWriteQueueMaxSize
-
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<ClientWebSocket> __TYPE_ARG
-
-
Constructor Detail
-
ClientWebSocket
public ClientWebSocket(io.vertx.core.http.ClientWebSocket delegate)
-
ClientWebSocket
public ClientWebSocket(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.core.http.ClientWebSocket getDelegate()
- Specified by:
getDelegatein interfaceReadStream<Buffer>- Specified by:
getDelegatein interfaceStreamBase- Specified by:
getDelegatein interfaceWebSocketBase- Specified by:
getDelegatein interfaceWriteStream<Buffer>- Overrides:
getDelegatein classWebSocket
-
toSubscriber
@CheckReturnValue public WriteStreamSubscriber<Buffer> toSubscriber()
- Overrides:
toSubscriberin classWebSocket
-
write
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> write(Buffer data)
Same as but with anhandlercalled 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:
writein interfaceWebSocketBase- Specified by:
writein interfaceWriteStream<Buffer>- Overrides:
writein classWebSocket- Parameters:
data-- Returns:
- the
unifiring 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:
writeAndAwaitin interfaceWebSocketBase- Specified by:
writeAndAwaitin interfaceWriteStream<Buffer>- Overrides:
writeAndAwaitin classWebSocket- 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:
writeAndForgetin interfaceWebSocketBase- Specified by:
writeAndForgetin interfaceWriteStream<Buffer>- Overrides:
writeAndForgetin classWebSocket- Parameters:
data-
-
end
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> end(Buffer data)
Same as but with anhandlercalled 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:
endin interfaceWebSocketBase- Specified by:
endin interfaceWriteStream<Buffer>- Overrides:
endin classWebSocket- Parameters:
data-- Returns:
- the
unifiring 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:
endAndAwaitin interfaceWebSocketBase- Specified by:
endAndAwaitin interfaceWriteStream<Buffer>- Overrides:
endAndAwaitin classWebSocket- 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:
endAndForgetin interfaceWebSocketBase- Specified by:
endAndForgetin interfaceWriteStream<Buffer>- Overrides:
endAndForgetin classWebSocket- Parameters:
data-
-
writeQueueFull
public boolean writeQueueFull()
- Specified by:
writeQueueFullin interfaceWebSocketBase- Specified by:
writeQueueFullin interfaceWriteStream<Buffer>- Overrides:
writeQueueFullin classWebSocket- Returns:
trueif write queue is full
-
pipe
public Pipe<Buffer> pipe()
- Specified by:
pipein interfaceReadStream<Buffer>- Specified by:
pipein interfaceWebSocketBase- Overrides:
pipein classWebSocket- Returns:
- a pipe
-
pipeTo
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> pipeTo(WriteStream<Buffer> dst)
Pipe thisReadStreamto 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
handlerwill 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:
pipeToin interfaceReadStream<Buffer>- Specified by:
pipeToin interfaceWebSocketBase- Overrides:
pipeToin classWebSocket- Parameters:
dst- the destination write stream- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
pipeToAndAwait
public Void pipeToAndAwait(WriteStream<Buffer> dst)
Blocking variant ofReadStream.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:
pipeToAndAwaitin interfaceReadStream<Buffer>- Specified by:
pipeToAndAwaitin interfaceWebSocketBase- Overrides:
pipeToAndAwaitin classWebSocket- Parameters:
dst- the destination write stream- Returns:
- the Void instance produced by the operation.
-
pipeToAndForget
public void pipeToAndForget(WriteStream<Buffer> dst)
Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)that ignores the result of the operation.This method subscribes on the result of
ReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)but you don't need to compose it with other operations.- Specified by:
pipeToAndForgetin interfaceReadStream<Buffer>- Specified by:
pipeToAndForgetin interfaceWebSocketBase- Overrides:
pipeToAndForgetin classWebSocket- Parameters:
dst- the destination write stream
-
binaryHandlerID
public String binaryHandlerID()
- Specified by:
binaryHandlerIDin interfaceWebSocketBase- Overrides:
binaryHandlerIDin classWebSocket- Returns:
- the binary handler id
-
textHandlerID
public String textHandlerID()
- Specified by:
textHandlerIDin interfaceWebSocketBase- Overrides:
textHandlerIDin classWebSocket- Returns:
- the text handler id
-
subProtocol
public String subProtocol()
- Specified by:
subProtocolin interfaceWebSocketBase- Overrides:
subProtocolin classWebSocket- Returns:
-
closeStatusCode
public Short closeStatusCode()
- Specified by:
closeStatusCodein interfaceWebSocketBase- Overrides:
closeStatusCodein classWebSocket- Returns:
-
closeReason
public String closeReason()
- Specified by:
closeReasonin interfaceWebSocketBase- Overrides:
closeReasonin classWebSocket- Returns:
-
headers
public MultiMap headers()
- Specified by:
headersin interfaceWebSocketBase- Overrides:
headersin classWebSocket- Returns:
- the headers
-
end
@CheckReturnValue 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:
endin interfaceWebSocketBase- Specified by:
endin interfaceWriteStream<Buffer>- Overrides:
endin classWebSocket- Returns:
- the
unifiring 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:
endAndAwaitin interfaceWebSocketBase- Specified by:
endAndAwaitin interfaceWriteStream<Buffer>- Overrides:
endAndAwaitin classWebSocket- 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:
endAndForgetin interfaceWebSocketBase- Specified by:
endAndForgetin interfaceWriteStream<Buffer>- Overrides:
endAndForgetin classWebSocket
-
close
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
Same asWebSocketBase.close()but with anhandlercalled 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:
closein interfaceWebSocketBase- Overrides:
closein classWebSocket- Returns:
- the
unifiring 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:
closeAndAwaitin interfaceWebSocketBase- Overrides:
closeAndAwaitin classWebSocket- 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:
closeAndForgetin interfaceWebSocketBase- Overrides:
closeAndForgetin classWebSocket
-
close
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> close(short statusCode)
Same asWebSocketBase.close()but with anhandlercalled 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:
closein interfaceWebSocketBase- Overrides:
closein classWebSocket- Parameters:
statusCode-- Returns:
- the
unifiring 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:
closeAndAwaitin interfaceWebSocketBase- Overrides:
closeAndAwaitin classWebSocket- 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:
closeAndForgetin interfaceWebSocketBase- Overrides:
closeAndForgetin classWebSocket- Parameters:
statusCode-
-
close
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> close(short statusCode, String reason)
Same asWebSocketBase.close()but with anhandlercalled 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:
closein interfaceWebSocketBase- Overrides:
closein classWebSocket- Parameters:
statusCode-reason-- Returns:
- the
unifiring 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:
closeAndAwaitin interfaceWebSocketBase- Overrides:
closeAndAwaitin classWebSocket- 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:
closeAndForgetin interfaceWebSocketBase- Overrides:
closeAndForgetin classWebSocket- Parameters:
statusCode-reason-
-
remoteAddress
public SocketAddress remoteAddress()
- Specified by:
remoteAddressin interfaceWebSocketBase- Overrides:
remoteAddressin classWebSocket- Returns:
- the remote address for this connection, possibly
null(e.g a server bound on a domain socket). IfuseProxyProtocolis set totrue, the address returned will be of the actual connecting client.
-
localAddress
public SocketAddress localAddress()
- Specified by:
localAddressin interfaceWebSocketBase- Overrides:
localAddressin classWebSocket- Returns:
- the local address for this connection, possibly
null(e.g a server bound on a domain socket) IfuseProxyProtocolis set totrue, the address returned will be of the proxy.
-
isSsl
public boolean isSsl()
- Specified by:
isSslin interfaceWebSocketBase- Overrides:
isSslin classWebSocket- Returns:
- true if this
HttpConnectionis encrypted via SSL/TLS.
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfaceWebSocketBase- Overrides:
isClosedin classWebSocket- Returns:
trueif the WebSocket is closed
-
connect
@CheckReturnValue public io.smallrye.mutiny.Uni<WebSocket> connect(int port, String host, String requestURI)
Connect a WebSocket to the specified port, host and relative request URIUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
port- the porthost- the hostrequestURI- the relative URI- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
public WebSocket connectAndAwait(int port, String host, String requestURI)
Blocking variant ofconnect(int,String,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).
- Parameters:
port- the porthost- the hostrequestURI- the relative URI- Returns:
- the WebSocket instance produced by the operation.
-
connectAndForget
public void connectAndForget(int port, String host, String requestURI)Variant ofconnect(int,String,String)that ignores the result of the operation.This method subscribes on the result of
connect(int,String,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(int,String,String)but you don't need to compose it with other operations.- Parameters:
port- the porthost- the hostrequestURI- the relative URI
-
connect
@CheckReturnValue public io.smallrye.mutiny.Uni<WebSocket> connect(io.vertx.core.http.WebSocketConnectOptions options)
Connect a WebSocket with the specified options.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
options- the request options- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
public WebSocket connectAndAwait(io.vertx.core.http.WebSocketConnectOptions options)
Blocking variant ofconnect(WebSocketConnectOptions).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).
- Parameters:
options- the request options- Returns:
- the WebSocket instance produced by the operation.
-
connectAndForget
public void connectAndForget(io.vertx.core.http.WebSocketConnectOptions options)
Variant ofconnect(WebSocketConnectOptions)that ignores the result of the operation.This method subscribes on the result of
connect(WebSocketConnectOptions), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(WebSocketConnectOptions)but you don't need to compose it with other operations.- Parameters:
options- the request options
-
connect
@CheckReturnValue public io.smallrye.mutiny.Uni<WebSocket> connect(String host, String requestURI)
Connect this WebSocket to the host and relative request URI and default port.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
host- the hostrequestURI- the relative URI- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
public WebSocket connectAndAwait(String host, String requestURI)
Blocking variant ofconnect(String,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).
- Parameters:
host- the hostrequestURI- the relative URI- Returns:
- the WebSocket instance produced by the operation.
-
connectAndForget
public void connectAndForget(String host, String requestURI)
Variant ofconnect(String,String)that ignores the result of the operation.This method subscribes on the result of
connect(String,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(String,String)but you don't need to compose it with other operations.- Parameters:
host- the hostrequestURI- the relative URI
-
connect
@CheckReturnValue public io.smallrye.mutiny.Uni<WebSocket> connect(String requestURI)
Connect this WebSocket at the relative request URI using the default host and port.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
requestURI- the relative URI- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
public WebSocket connectAndAwait(String requestURI)
Blocking variant ofconnect(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).
- Parameters:
requestURI- the relative URI- Returns:
- the WebSocket instance produced by the operation.
-
connectAndForget
public void connectAndForget(String requestURI)
Variant ofconnect(String)that ignores the result of the operation.This method subscribes on the result of
connect(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(String)but you don't need to compose it with other operations.- Parameters:
requestURI- the relative URI
-
handler
public ClientWebSocket handler(Consumer<Buffer> handler)
- Specified by:
handlerin interfaceReadStream<Buffer>- Specified by:
handlerin interfaceWebSocketBase- Overrides:
handlerin classWebSocket- Returns:
-
endHandler
public ClientWebSocket endHandler(Runnable endHandler)
- Specified by:
endHandlerin interfaceReadStream<Buffer>- Specified by:
endHandlerin interfaceWebSocketBase- Overrides:
endHandlerin classWebSocket- Returns:
-
drainHandler
public ClientWebSocket drainHandler(Runnable handler)
- Specified by:
drainHandlerin interfaceWebSocketBase- Specified by:
drainHandlerin interfaceWriteStream<Buffer>- Overrides:
drainHandlerin classWebSocket- Parameters:
handler- the handler- Returns:
-
closeHandler
public ClientWebSocket closeHandler(Runnable handler)
- Specified by:
closeHandlerin interfaceWebSocketBase- Overrides:
closeHandlerin classWebSocket- Parameters:
handler- the handler- Returns:
-
frameHandler
public ClientWebSocket frameHandler(Consumer<WebSocketFrame> handler)
- Specified by:
frameHandlerin interfaceWebSocketBase- Overrides:
frameHandlerin classWebSocket- Parameters:
handler- the handler- Returns:
-
textMessageHandler
public ClientWebSocket textMessageHandler(Consumer<String> handler)
- Specified by:
textMessageHandlerin interfaceWebSocketBase- Overrides:
textMessageHandlerin classWebSocket- Parameters:
handler- the handler- Returns:
-
binaryMessageHandler
public ClientWebSocket binaryMessageHandler(Consumer<Buffer> handler)
- Specified by:
binaryMessageHandlerin interfaceWebSocketBase- Overrides:
binaryMessageHandlerin classWebSocket- Parameters:
handler- the handler- Returns:
-
pongHandler
public ClientWebSocket pongHandler(Consumer<Buffer> handler)
- Specified by:
pongHandlerin interfaceWebSocketBase- Overrides:
pongHandlerin classWebSocket- Parameters:
handler- the handler- Returns:
-
exceptionHandler
public ClientWebSocket exceptionHandler(Consumer<Throwable> handler)
- Specified by:
exceptionHandlerin interfaceReadStream<Buffer>- Specified by:
exceptionHandlerin interfaceStreamBase- Specified by:
exceptionHandlerin interfaceWebSocketBase- Specified by:
exceptionHandlerin interfaceWriteStream<Buffer>- Overrides:
exceptionHandlerin classWebSocket- Parameters:
handler- the exception handler- Returns:
-
writeFrame
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> writeFrame(WebSocketFrame frame)
Description copied from interface:WebSocketBaseSame asWebSocketBase.writeFrame(io.vertx.mutiny.core.http.WebSocketFrame)but with anhandlercalled 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:
writeFramein interfaceWebSocketBase- Overrides:
writeFramein classWebSocket- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeFrameAndAwait
public Void writeFrameAndAwait(WebSocketFrame frame)
Description copied from interface:WebSocketBaseBlocking 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:
writeFrameAndAwaitin interfaceWebSocketBase- Overrides:
writeFrameAndAwaitin classWebSocket- Returns:
- the Void instance produced by the operation.
-
writeFrameAndForget
public ClientWebSocket writeFrameAndForget(WebSocketFrame frame)
Description copied from interface:WebSocketBaseVariant 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:
writeFrameAndForgetin interfaceWebSocketBase- Overrides:
writeFrameAndForgetin classWebSocket- Returns:
- the instance of WebSocketBase to chain method calls.
-
writeFinalTextFrame
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> writeFinalTextFrame(String text)
Description copied from interface:WebSocketBaseSame asWebSocketBase.writeFinalTextFrame(java.lang.String)but with anhandlercalled 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:
writeFinalTextFramein interfaceWebSocketBase- Overrides:
writeFinalTextFramein classWebSocket- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeFinalTextFrameAndAwait
public Void writeFinalTextFrameAndAwait(String text)
Description copied from interface:WebSocketBaseBlocking 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:
writeFinalTextFrameAndAwaitin interfaceWebSocketBase- Overrides:
writeFinalTextFrameAndAwaitin classWebSocket- Returns:
- the Void instance produced by the operation.
-
writeFinalTextFrameAndForget
public ClientWebSocket writeFinalTextFrameAndForget(String text)
Description copied from interface:WebSocketBaseVariant 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:
writeFinalTextFrameAndForgetin interfaceWebSocketBase- Overrides:
writeFinalTextFrameAndForgetin classWebSocket- Returns:
- the instance of WebSocketBase to chain method calls.
-
writeFinalBinaryFrame
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> writeFinalBinaryFrame(Buffer data)
Description copied from interface:WebSocketBaseSame asWebSocketBase.writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer)but with anhandlercalled 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:
writeFinalBinaryFramein interfaceWebSocketBase- Overrides:
writeFinalBinaryFramein classWebSocket- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeFinalBinaryFrameAndAwait
public Void writeFinalBinaryFrameAndAwait(Buffer data)
Description copied from interface:WebSocketBaseBlocking 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:
writeFinalBinaryFrameAndAwaitin interfaceWebSocketBase- Overrides:
writeFinalBinaryFrameAndAwaitin classWebSocket- Returns:
- the Void instance produced by the operation.
-
writeFinalBinaryFrameAndForget
public ClientWebSocket writeFinalBinaryFrameAndForget(Buffer data)
Description copied from interface:WebSocketBaseVariant 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:
writeFinalBinaryFrameAndForgetin interfaceWebSocketBase- Overrides:
writeFinalBinaryFrameAndForgetin classWebSocket- Returns:
- the instance of WebSocketBase to chain method calls.
-
writeBinaryMessage
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> writeBinaryMessage(Buffer data)
Description copied from interface:WebSocketBaseSame asWebSocketBase.writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer)but with anhandlercalled 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:
writeBinaryMessagein interfaceWebSocketBase- Overrides:
writeBinaryMessagein classWebSocket- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeBinaryMessageAndAwait
public Void writeBinaryMessageAndAwait(Buffer data)
Description copied from interface:WebSocketBaseBlocking 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:
writeBinaryMessageAndAwaitin interfaceWebSocketBase- Overrides:
writeBinaryMessageAndAwaitin classWebSocket- Returns:
- the Void instance produced by the operation.
-
writeBinaryMessageAndForget
public ClientWebSocket writeBinaryMessageAndForget(Buffer data)
Description copied from interface:WebSocketBaseVariant 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:
writeBinaryMessageAndForgetin interfaceWebSocketBase- Overrides:
writeBinaryMessageAndForgetin classWebSocket- Returns:
- the instance of WebSocketBase to chain method calls.
-
writeTextMessage
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> writeTextMessage(String text)
Description copied from interface:WebSocketBaseSame asWebSocketBase.writeTextMessage(java.lang.String)but with anhandlercalled 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:
writeTextMessagein interfaceWebSocketBase- Overrides:
writeTextMessagein classWebSocket- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeTextMessageAndAwait
public Void writeTextMessageAndAwait(String text)
Description copied from interface:WebSocketBaseBlocking 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:
writeTextMessageAndAwaitin interfaceWebSocketBase- Overrides:
writeTextMessageAndAwaitin classWebSocket- Returns:
- the Void instance produced by the operation.
-
writeTextMessageAndForget
public ClientWebSocket writeTextMessageAndForget(String text)
Description copied from interface:WebSocketBaseVariant 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:
writeTextMessageAndForgetin interfaceWebSocketBase- Overrides:
writeTextMessageAndForgetin classWebSocket- Returns:
- the instance of WebSocketBase to chain method calls.
-
writePing
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> writePing(Buffer data)
Description copied from interface:WebSocketBaseWrites 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:
writePingin interfaceWebSocketBase- Overrides:
writePingin classWebSocket- Parameters:
data- the data to write, may be at most 125 bytes- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writePingAndAwait
public Void writePingAndAwait(Buffer data)
Description copied from interface:WebSocketBaseBlocking 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:
writePingAndAwaitin interfaceWebSocketBase- Overrides:
writePingAndAwaitin classWebSocket- Parameters:
data- the data to write, may be at most 125 bytes- Returns:
- the Void instance produced by the operation.
-
writePingAndForget
public ClientWebSocket writePingAndForget(Buffer data)
Description copied from interface:WebSocketBaseVariant 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:
writePingAndForgetin interfaceWebSocketBase- Overrides:
writePingAndForgetin classWebSocket- Parameters:
data- the data to write, may be at most 125 bytes- Returns:
- the instance of WebSocketBase to chain method calls.
-
writePong
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> writePong(Buffer data)
Description copied from interface:WebSocketBaseWrites 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:
writePongin interfaceWebSocketBase- Overrides:
writePongin classWebSocket- Parameters:
data- the data to write, may be at most 125 bytes- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writePongAndAwait
public Void writePongAndAwait(Buffer data)
Description copied from interface:WebSocketBaseBlocking 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:
writePongAndAwaitin interfaceWebSocketBase- Overrides:
writePongAndAwaitin classWebSocket- Parameters:
data- the data to write, may be at most 125 bytes- Returns:
- the Void instance produced by the operation.
-
writePongAndForget
public ClientWebSocket writePongAndForget(Buffer data)
Description copied from interface:WebSocketBaseVariant 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:
writePongAndForgetin interfaceWebSocketBase- Overrides:
writePongAndForgetin classWebSocket- Parameters:
data- the data to write, may be at most 125 bytes- Returns:
- the instance of WebSocketBase to chain method calls.
-
sslSession
public SSLSession sslSession()
- Specified by:
sslSessionin interfaceWebSocketBase- Overrides:
sslSessionin classWebSocket- Returns:
- SSLSession associated with the underlying socket. Returns null if connection is not SSL.
-
toMulti
@CheckReturnValue public io.smallrye.mutiny.Multi<Buffer> toMulti()
- Specified by:
toMultiin interfaceReadStream<Buffer>- Overrides:
toMultiin classWebSocket
-
toBlockingIterable
public Iterable<Buffer> toBlockingIterable()
- Overrides:
toBlockingIterablein classWebSocket
-
toBlockingStream
public Stream<Buffer> toBlockingStream()
- Overrides:
toBlockingStreamin classWebSocket
-
newInstance
public static ClientWebSocket newInstance(io.vertx.core.http.ClientWebSocket arg)
-
-