Class ServerWebSocket
- java.lang.Object
-
- io.vertx.mutiny.core.http.ServerWebSocket
-
- All Implemented Interfaces:
WebSocketBase,ReadStream<Buffer>,StreamBase,WriteStream<Buffer>
public class ServerWebSocket extends Object implements WebSocketBase
Represents a server side WebSocket.Instances of this class are passed into a
NOTE: This class has been automatically generated from theHttpServer.webSocketHandler(java.util.function.Consumer<io.vertx.mutiny.core.http.ServerWebSocket>)or provided when a WebSocket handshake is manuallyHttpServerRequest.upgrade()ed.originalnon Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<ServerWebSocket>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description ServerWebSocket(io.vertx.core.http.ServerWebSocket delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept()StringbinaryHandlerID()WebSocketBasebinaryMessageHandler(Consumer<Buffer> handler)io.smallrye.mutiny.Uni<Void>close()Same asclose()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 ofclose()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.ServerWebSocketcloseHandler(Consumer<Void> handler)StringcloseReason()ShortcloseStatusCode()ServerWebSocketdrainHandler(Consumer<Void> 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.ServerWebSocketendHandler(Consumer<Void> endHandler)booleanequals(Object o)ServerWebSocketexceptionHandler(Consumer<Throwable> handler)ServerWebSocketfetch(long amount)ServerWebSocketframeHandler(Consumer<WebSocketFrame> handler)io.vertx.core.http.ServerWebSocketgetDelegate()ServerWebSockethandler(Consumer<Buffer> handler)inthashCode()MultiMapheaders()booleanisClosed()booleanisSsl()SocketAddresslocalAddress()static ServerWebSocketnewInstance(io.vertx.core.http.ServerWebSocket arg)Stringpath()ServerWebSocketpause()Pipe<Buffer>pipe()io.smallrye.mutiny.Uni<Void>pipeTo(WriteStream<Buffer> dst)Pipe thisReadStreamto theWriteStream.VoidpipeToAndAwait(WriteStream<Buffer> dst)Blocking variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream.) voidpipeToAndForget(WriteStream<Buffer> dst)Variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStreamthat ignores the result of the operation.) WebSocketBasepongHandler(Consumer<Buffer> handler)Stringquery()voidreject()voidreject(int status)SocketAddressremoteAddress()ServerWebSocketresume()io.smallrye.mutiny.Uni<Integer>setHandshake(Future<Integer> future)Set an asynchronous result for the handshake, upon completion of the specifiedfuture, the WebSocket will either be accepted when thefuturesucceeds with the HTTP status code rejected when thefutureis succeeds with an HTTP status code different than rejected when thefuturefails with the HTTP status code500The provided future might be completed by the WebSocket itself, e.g calling theclose()method will try to accept the handshake and close the WebSocket afterward.IntegersetHandshakeAndAwait(Future<Integer> future)Blocking variant ofio.vertx.mutiny.core.http.ServerWebSocket#setHandshake(io.vertx.mutiny.core.Future.) voidsetHandshakeAndForget(Future<Integer> future)Variant ofio.vertx.mutiny.core.http.ServerWebSocket#setHandshake(io.vertx.mutiny.core.Futurethat ignores the result of the operation.) ServerWebSocketsetWriteQueueMaxSize(int maxSize)SSLSessionsslSession()StringsubProtocol()StringtextHandlerID()WebSocketBasetextMessageHandler(Consumer<String> handler)Iterable<Buffer>toBlockingIterable()Stream<Buffer>toBlockingStream()io.smallrye.mutiny.Multi<Buffer>toMulti()StringtoString()WriteStreamSubscriber<Buffer>toSubscriber()Stringuri()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(T).ServerWebSocketwriteAndForget(Buffer data)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).ServerWebSocketwriteBinaryMessageAndForget(Buffer data)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).ServerWebSocketwriteFinalBinaryFrameAndForget(Buffer data)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).ServerWebSocketwriteFinalTextFrameAndForget(String text)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).ServerWebSocketwriteFrameAndForget(WebSocketFrame frame)WebSocketBasewritePing(Buffer data)WebSocketBasewritePong(Buffer data)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).ServerWebSocketwriteTextMessageAndForget(String text)
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<ServerWebSocket> __TYPE_ARG
-
-
Method Detail
-
getDelegate
public io.vertx.core.http.ServerWebSocket getDelegate()
- Specified by:
getDelegatein interfaceReadStream<Buffer>- Specified by:
getDelegatein interfaceStreamBase- Specified by:
getDelegatein interfaceWebSocketBase- Specified by:
getDelegatein interfaceWriteStream<Buffer>
-
toSubscriber
public WriteStreamSubscriber<Buffer> toSubscriber()
-
end
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>- 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>- Parameters:
data-- Returns:
- the Void instance produced by the operation
-
writeQueueFull
public boolean writeQueueFull()
- Specified by:
writeQueueFullin interfaceWebSocketBase- Specified by:
writeQueueFullin interfaceWriteStream<Buffer>- Returns:
- true if write queue is full
-
pipe
public Pipe<Buffer> pipe()
- Specified by:
pipein interfaceReadStream<Buffer>- Specified by:
pipein interfaceWebSocketBase- Returns:
- a pipe
-
pipeTo
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- 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 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:
pipeToAndAwaitin interfaceReadStream<Buffer>- Specified by:
pipeToAndAwaitin interfaceWebSocketBase- Parameters:
dst- the destination write stream- Returns:
- the Void instance produced by the operation
-
binaryHandlerID
public String binaryHandlerID()
- Specified by:
binaryHandlerIDin interfaceWebSocketBase- Returns:
- the binary handler id
-
textHandlerID
public String textHandlerID()
- Specified by:
textHandlerIDin interfaceWebSocketBase- Returns:
-
subProtocol
public String subProtocol()
- Specified by:
subProtocolin interfaceWebSocketBase- Returns:
-
closeStatusCode
public Short closeStatusCode()
- Specified by:
closeStatusCodein interfaceWebSocketBase- Returns:
-
closeReason
public String closeReason()
- Specified by:
closeReasonin interfaceWebSocketBase- Returns:
-
headers
public MultiMap headers()
- Specified by:
headersin interfaceWebSocketBase- Returns:
- the headers
-
writePing
public WebSocketBase writePing(Buffer data)
- Specified by:
writePingin interfaceWebSocketBase- Parameters:
data- the data to write, may be at most 125 bytes- Returns:
- a reference to this, so the API can be used fluently
-
writePong
public WebSocketBase writePong(Buffer data)
- Specified by:
writePongin interfaceWebSocketBase- Parameters:
data- the data to write, may be at most 125 bytes- Returns:
- a reference to this, so the API can be used fluently
-
textMessageHandler
public WebSocketBase textMessageHandler(Consumer<String> handler)
- Specified by:
textMessageHandlerin interfaceWebSocketBase- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
binaryMessageHandler
public WebSocketBase binaryMessageHandler(Consumer<Buffer> handler)
- Specified by:
binaryMessageHandlerin interfaceWebSocketBase- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
pongHandler
public WebSocketBase pongHandler(Consumer<Buffer> handler)
- Specified by:
pongHandlerin interfaceWebSocketBase- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
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:
endin interfaceWebSocketBase- Specified by:
endin interfaceWriteStream<Buffer>- 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>- Returns:
- the Void instance produced by the operation
-
close
public io.smallrye.mutiny.Uni<Void> close()
Same asclose()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- 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- Returns:
- the Void instance produced by the operation
-
close
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- 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- Parameters:
statusCode-- Returns:
- the Void instance produced by the operation
-
close
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- 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- Parameters:
statusCode-reason-- Returns:
- the Void instance produced by the operation
-
remoteAddress
public SocketAddress remoteAddress()
- Specified by:
remoteAddressin interfaceWebSocketBase- Returns:
- the remote address for this connection, possibly
null(e.g a server bound on a domain socket)
-
localAddress
public SocketAddress localAddress()
- Specified by:
localAddressin interfaceWebSocketBase- Returns:
- the local address for this connection, possibly
null(e.g a server bound on a domain socket)
-
isSsl
public boolean isSsl()
- Specified by:
isSslin interfaceWebSocketBase- Returns:
- true if this
HttpConnectionis encrypted via SSL/TLS.
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfaceWebSocketBase- Returns:
trueif the WebSocket is closed
-
exceptionHandler
public ServerWebSocket exceptionHandler(Consumer<Throwable> handler)
- Specified by:
exceptionHandlerin interfaceReadStream<Buffer>- Specified by:
exceptionHandlerin interfaceStreamBase- Specified by:
exceptionHandlerin interfaceWebSocketBase- Specified by:
exceptionHandlerin interfaceWriteStream<Buffer>- Parameters:
handler- the exception handler- Returns:
- a reference to this, so the API can be used fluently
-
handler
public ServerWebSocket handler(Consumer<Buffer> handler)
- Specified by:
handlerin interfaceReadStream<Buffer>- Specified by:
handlerin interfaceWebSocketBase- Returns:
- a reference to this, so the API can be used fluently
-
pause
public ServerWebSocket pause()
- Specified by:
pausein interfaceReadStream<Buffer>- Specified by:
pausein interfaceWebSocketBase- Returns:
- a reference to this, so the API can be used fluently
-
resume
public ServerWebSocket resume()
- Specified by:
resumein interfaceReadStream<Buffer>- Specified by:
resumein interfaceWebSocketBase- Returns:
- a reference to this, so the API can be used fluently
-
fetch
public ServerWebSocket fetch(long amount)
- Specified by:
fetchin interfaceReadStream<Buffer>- Specified by:
fetchin interfaceWebSocketBase- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
public ServerWebSocket endHandler(Consumer<Void> endHandler)
- Specified by:
endHandlerin interfaceReadStream<Buffer>- Specified by:
endHandlerin interfaceWebSocketBase- Returns:
- a reference to this, so the API can be used fluently
-
write
public io.smallrye.mutiny.Uni<Void> write(Buffer data)
Description copied from interface:WriteStreamSame 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>- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeAndAwait
public Void writeAndAwait(Buffer data)
Description copied from interface:WriteStreamBlocking variant ofio.vertx.mutiny.core.streams.WriteStream#write(T).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>- Returns:
- the Void instance produced by the operation
-
setWriteQueueMaxSize
public ServerWebSocket setWriteQueueMaxSize(int maxSize)
- Specified by:
setWriteQueueMaxSizein interfaceWebSocketBase- Specified by:
setWriteQueueMaxSizein 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 ServerWebSocket drainHandler(Consumer<Void> handler)
- Specified by:
drainHandlerin interfaceWebSocketBase- Specified by:
drainHandlerin interfaceWriteStream<Buffer>- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
writeFrame
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- 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- Returns:
- the Void instance produced by the operation
-
writeFinalTextFrame
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- 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- Returns:
- the Void instance produced by the operation
-
writeFinalBinaryFrame
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- 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- Returns:
- the Void instance produced by the operation
-
writeBinaryMessage
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- 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- Returns:
- the Void instance produced by the operation
-
writeTextMessage
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- 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- Returns:
- the Void instance produced by the operation
-
closeHandler
public ServerWebSocket closeHandler(Consumer<Void> handler)
- Specified by:
closeHandlerin interfaceWebSocketBase- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
frameHandler
public ServerWebSocket frameHandler(Consumer<WebSocketFrame> handler)
- Specified by:
frameHandlerin interfaceWebSocketBase- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
uri
public String uri()
-
path
public String path()
- Returns:
- the WebSocket handshake path.
-
query
public String query()
- Returns:
- the WebSocket handshake query string.
-
accept
public void accept()
-
reject
public void reject()
-
reject
public void reject(int status)
- Parameters:
status-
-
setHandshake
public io.smallrye.mutiny.Uni<Integer> setHandshake(Future<Integer> future)
Set an asynchronous result for the handshake, upon completion of the specifiedfuture, the WebSocket will either be- accepted when the
futuresucceeds with the HTTP status code - rejected when the
futureis succeeds with an HTTP status code different than - rejected when the
futurefails with the HTTP status code500
close()method will try to accept the handshake and close the WebSocket afterward. Thus it is advised to try to complete thefuturewith or .This method should be called from the WebSocket handler to explicitly set an asynchronous handshake.
Calling this method will override the
futurecompletion handler.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
future- the future to complete with- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
- accepted when the
-
setHandshakeAndAwait
public Integer setHandshakeAndAwait(Future<Integer> future)
Blocking variant ofio.vertx.mutiny.core.http.ServerWebSocket#setHandshake(io.vertx.mutiny.core.Future.) 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:
future- the future to complete with- Returns:
- the Integer instance produced by the operation
-
sslSession
public SSLSession sslSession()
- Specified by:
sslSessionin interfaceWebSocketBase- Returns:
- SSLSession associated with the underlying socket. Returns null if connection is not SSL.
-
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.- Parameters:
data- the data to write
-
pipeToAndForget
public void pipeToAndForget(WriteStream<Buffer> dst)
Variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStreamthat 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.WriteStreambut you don't need to compose it with other operations.) - Parameters:
dst-
-
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.
-
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.- Parameters:
statusCode- Status code
-
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.- Parameters:
statusCode- Status codereason- reason of closure
-
writeAndForget
public ServerWebSocket writeAndForget(Buffer data)
-
writeFrameAndForget
public ServerWebSocket writeFrameAndForget(WebSocketFrame frame)
-
writeFinalTextFrameAndForget
public ServerWebSocket writeFinalTextFrameAndForget(String text)
-
writeFinalBinaryFrameAndForget
public ServerWebSocket writeFinalBinaryFrameAndForget(Buffer data)
-
writeBinaryMessageAndForget
public ServerWebSocket writeBinaryMessageAndForget(Buffer data)
-
writeTextMessageAndForget
public ServerWebSocket writeTextMessageAndForget(String text)
-
setHandshakeAndForget
public void setHandshakeAndForget(Future<Integer> future)
Variant ofio.vertx.mutiny.core.http.ServerWebSocket#setHandshake(io.vertx.mutiny.core.Futurethat ignores the result of the operation.) This method subscribes on the result of
io.vertx.mutiny.core.http.ServerWebSocket#setHandshake(io.vertx.mutiny.core.Future, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from) io.vertx.mutiny.core.http.ServerWebSocket#setHandshake(io.vertx.mutiny.core.Futurebut you don't need to compose it with other operations.) - Parameters:
future-
-
closeAndForget
public void closeAndForget()
-
toMulti
public io.smallrye.mutiny.Multi<Buffer> toMulti()
- Specified by:
toMultiin interfaceReadStream<Buffer>
-
newInstance
public static ServerWebSocket newInstance(io.vertx.core.http.ServerWebSocket arg)
-
-