Interface WebSocketBase
-
- All Superinterfaces:
ReadStream<Buffer>,StreamBase,WriteStream<Buffer>
- All Known Implementing Classes:
ServerWebSocket,WebSocket
public interface WebSocketBase extends ReadStream<Buffer>, WriteStream<Buffer>
Base WebSocket implementation.It implements both and so it can be used with
NOTE: This class has been automatically generated from thePipeto pipe data with flow control.originalnon Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<Buffer>TYPE_ARG_0
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description 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 asclose()but with anhandlercalled when the operation completesio.smallrye.mutiny.Uni<Void>close(short statusCode, String reason)Same asclose()but with anhandlercalled when the operation completesVoidcloseAndAwait()Blocking variant ofclose().VoidcloseAndAwait(short statusCode)Blocking variant ofclose(short).VoidcloseAndAwait(short statusCode, String reason)Blocking variant ofclose(short,String).WebSocketBasecloseHandler(Consumer<Void> handler)StringcloseReason()ShortcloseStatusCode()WebSocketBasedrainHandler(Consumer<Void> handler)io.smallrye.mutiny.Uni<Void>end()Callsclose()io.smallrye.mutiny.Uni<Void>end(Buffer data)Same as but with anhandlercalled when the operation completesVoidendAndAwait()Blocking variant ofend(io.vertx.mutiny.core.buffer.Buffer).VoidendAndAwait(Buffer data)Blocking variant ofio.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer).WebSocketBaseendHandler(Consumer<Void> endHandler)WebSocketBaseexceptionHandler(Consumer<Throwable> handler)WebSocketBasefetch(long amount)WebSocketBaseframeHandler(Consumer<WebSocketFrame> handler)io.vertx.core.http.WebSocketBasegetDelegate()WebSocketBasehandler(Consumer<Buffer> handler)MultiMapheaders()booleanisClosed()booleanisSsl()SocketAddresslocalAddress()static WebSocketBasenewInstance(io.vertx.core.http.WebSocketBase arg)WebSocketBasepause()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.) WebSocketBasepongHandler(Consumer<Buffer> handler)SocketAddressremoteAddress()WebSocketBaseresume()WebSocketBasesetWriteQueueMaxSize(int maxSize)SSLSessionsslSession()StringsubProtocol()StringtextHandlerID()WebSocketBasetextMessageHandler(Consumer<String> handler)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).io.smallrye.mutiny.Uni<Void>writeBinaryMessage(Buffer data)Same aswriteBinaryMessage(io.vertx.mutiny.core.buffer.Buffer)but with anhandlercalled when the operation completesVoidwriteBinaryMessageAndAwait(Buffer data)Blocking variant ofwriteBinaryMessage(io.vertx.mutiny.core.buffer.Buffer).io.smallrye.mutiny.Uni<Void>writeFinalBinaryFrame(Buffer data)Same aswriteFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer)but with anhandlercalled when the operation completesVoidwriteFinalBinaryFrameAndAwait(Buffer data)Blocking variant ofwriteFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer).io.smallrye.mutiny.Uni<Void>writeFinalTextFrame(String text)Same aswriteFinalTextFrame(java.lang.String)but with anhandlercalled when the operation completesVoidwriteFinalTextFrameAndAwait(String text)Blocking variant ofwriteFinalTextFrame(String).io.smallrye.mutiny.Uni<Void>writeFrame(WebSocketFrame frame)Same aswriteFrame(io.vertx.mutiny.core.http.WebSocketFrame)but with anhandlercalled when the operation completesVoidwriteFrameAndAwait(WebSocketFrame frame)Blocking variant ofwriteFrame(io.vertx.mutiny.core.http.WebSocketFrame).WebSocketBasewritePing(Buffer data)WebSocketBasewritePong(Buffer data)booleanwriteQueueFull()io.smallrye.mutiny.Uni<Void>writeTextMessage(String text)Same aswriteTextMessage(java.lang.String)but with anhandlercalled when the operation completesVoidwriteTextMessageAndAwait(String text)Blocking variant ofwriteTextMessage(String).-
Methods inherited from interface io.vertx.mutiny.core.streams.ReadStream
toMulti
-
-
-
-
Method Detail
-
getDelegate
io.vertx.core.http.WebSocketBase getDelegate()
- Specified by:
getDelegatein interfaceReadStream<Buffer>- Specified by:
getDelegatein interfaceStreamBase- Specified by:
getDelegatein interfaceWriteStream<Buffer>
-
end
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 interfaceWriteStream<Buffer>- Parameters:
data-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
endAndAwait
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 interfaceWriteStream<Buffer>- Parameters:
data-- Returns:
- the Void instance produced by the operation
-
writeQueueFull
boolean writeQueueFull()
- Specified by:
writeQueueFullin interfaceWriteStream<Buffer>- Returns:
- true if write queue is full
-
pipe
Pipe<Buffer> pipe()
- Specified by:
pipein interfaceReadStream<Buffer>- Returns:
- a pipe
-
pipeTo
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>- Parameters:
dst- the destination write stream- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
pipeToAndAwait
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>- Parameters:
dst- the destination write stream- Returns:
- the Void instance produced by the operation
-
exceptionHandler
WebSocketBase exceptionHandler(Consumer<Throwable> handler)
- Specified by:
exceptionHandlerin interfaceReadStream<Buffer>- Specified by:
exceptionHandlerin interfaceStreamBase- Specified by:
exceptionHandlerin interfaceWriteStream<Buffer>- Parameters:
handler- the exception handler- Returns:
- a reference to this, so the API can be used fluently
-
handler
WebSocketBase handler(Consumer<Buffer> handler)
- Specified by:
handlerin interfaceReadStream<Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
pause
WebSocketBase pause()
- Specified by:
pausein interfaceReadStream<Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
resume
WebSocketBase resume()
- Specified by:
resumein interfaceReadStream<Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
fetch
WebSocketBase fetch(long amount)
- Specified by:
fetchin interfaceReadStream<Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
WebSocketBase endHandler(Consumer<Void> endHandler)
- Specified by:
endHandlerin interfaceReadStream<Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
write
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 interfaceWriteStream<Buffer>- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeAndAwait
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 interfaceWriteStream<Buffer>- Returns:
- the Void instance produced by the operation
-
setWriteQueueMaxSize
WebSocketBase setWriteQueueMaxSize(int maxSize)
- 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
WebSocketBase drainHandler(Consumer<Void> handler)
- Specified by:
drainHandlerin interfaceWriteStream<Buffer>- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
binaryHandlerID
String binaryHandlerID()
- Returns:
- the binary handler id
-
textHandlerID
String textHandlerID()
- Returns:
-
subProtocol
String subProtocol()
- Returns:
-
closeStatusCode
Short closeStatusCode()
- Returns:
-
closeReason
String closeReason()
- Returns:
-
headers
MultiMap headers()
- Returns:
- the headers
-
writeFrame
io.smallrye.mutiny.Uni<Void> writeFrame(WebSocketFrame frame)
Same aswriteFrame(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.- Parameters:
frame-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeFrameAndAwait
Void writeFrameAndAwait(WebSocketFrame frame)
Blocking variant ofwriteFrame(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).
- Parameters:
frame-- Returns:
- the Void instance produced by the operation
-
writeFinalTextFrame
io.smallrye.mutiny.Uni<Void> writeFinalTextFrame(String text)
Same aswriteFinalTextFrame(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.- Parameters:
text-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeFinalTextFrameAndAwait
Void writeFinalTextFrameAndAwait(String text)
Blocking variant ofwriteFinalTextFrame(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:
text-- Returns:
- the Void instance produced by the operation
-
writeFinalBinaryFrame
io.smallrye.mutiny.Uni<Void> writeFinalBinaryFrame(Buffer data)
Same aswriteFinalBinaryFrame(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.- Parameters:
data-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeFinalBinaryFrameAndAwait
Void writeFinalBinaryFrameAndAwait(Buffer data)
Blocking variant ofwriteFinalBinaryFrame(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).
- Parameters:
data-- Returns:
- the Void instance produced by the operation
-
writeBinaryMessage
io.smallrye.mutiny.Uni<Void> writeBinaryMessage(Buffer data)
Same aswriteBinaryMessage(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.- Parameters:
data-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeBinaryMessageAndAwait
Void writeBinaryMessageAndAwait(Buffer data)
Blocking variant ofwriteBinaryMessage(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).
- Parameters:
data-- Returns:
- the Void instance produced by the operation
-
writeTextMessage
io.smallrye.mutiny.Uni<Void> writeTextMessage(String text)
Same aswriteTextMessage(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.- Parameters:
text-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeTextMessageAndAwait
Void writeTextMessageAndAwait(String text)
Blocking variant ofwriteTextMessage(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:
text-- Returns:
- the Void instance produced by the operation
-
writePing
WebSocketBase writePing(Buffer data)
- 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
WebSocketBase writePong(Buffer data)
- Parameters:
data- the data to write, may be at most 125 bytes- Returns:
- a reference to this, so the API can be used fluently
-
closeHandler
WebSocketBase closeHandler(Consumer<Void> handler)
- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
frameHandler
WebSocketBase frameHandler(Consumer<WebSocketFrame> handler)
- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
textMessageHandler
WebSocketBase textMessageHandler(Consumer<String> handler)
- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
binaryMessageHandler
WebSocketBase binaryMessageHandler(Consumer<Buffer> handler)
- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
pongHandler
WebSocketBase pongHandler(Consumer<Buffer> handler)
- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
end
io.smallrye.mutiny.Uni<Void> end()
Callsclose()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 interfaceWriteStream<Buffer>- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
endAndAwait
Void endAndAwait()
Blocking variant ofend(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 interfaceWriteStream<Buffer>- Returns:
- the Void instance produced by the operation
-
close
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.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
closeAndAwait
Void closeAndAwait()
Blocking variant ofclose().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).
- Returns:
- the Void instance produced by the operation
-
close
io.smallrye.mutiny.Uni<Void> close(short statusCode)
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.- Parameters:
statusCode-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
closeAndAwait
Void closeAndAwait(short statusCode)
Blocking variant ofclose(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).
- Parameters:
statusCode-- Returns:
- the Void instance produced by the operation
-
close
io.smallrye.mutiny.Uni<Void> close(short statusCode, String reason)
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.- Parameters:
statusCode-reason-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
closeAndAwait
Void closeAndAwait(short statusCode, String reason)
Blocking variant ofclose(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).
- Parameters:
statusCode-reason-- Returns:
- the Void instance produced by the operation
-
remoteAddress
SocketAddress remoteAddress()
- Returns:
- the remote address for this connection, possibly
null(e.g a server bound on a domain socket)
-
localAddress
SocketAddress localAddress()
- Returns:
- the local address for this connection, possibly
null(e.g a server bound on a domain socket)
-
isSsl
boolean isSsl()
- Returns:
- true if this
HttpConnectionis encrypted via SSL/TLS.
-
isClosed
boolean isClosed()
- Returns:
trueif the WebSocket is closed
-
sslSession
SSLSession sslSession()
- Returns:
- SSLSession associated with the underlying socket. Returns null if connection is not SSL.
-
newInstance
static WebSocketBase newInstance(io.vertx.core.http.WebSocketBase arg)
-
-