Class SockJSSocket
- java.lang.Object
-
- io.vertx.mutiny.ext.web.handler.sockjs.SockJSSocket
-
- All Implemented Interfaces:
ReadStream<Buffer>,StreamBase,WriteStream<Buffer>
public class SockJSSocket extends Object implements ReadStream<Buffer>, WriteStream<Buffer>
You interact with SockJS clients through instances of SockJS socket.The API is very similar to
WebSocket. It implements both and so it can be used withPumpto pump data with flow control.
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<SockJSSocket>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description SockJSSocket(io.vertx.ext.web.handler.sockjs.SockJSSocket delegate)SockJSSocket(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidclose(int statusCode, String reason)SockJSSocketcloseHandler(Runnable closeHandler)SockJSSocketdrainHandler(Runnable handler)io.smallrye.mutiny.Uni<Void>end()Same asWriteStream.end()but with anhandlercalled when the operation completesio.smallrye.mutiny.Uni<Void>end(Buffer data)Same as but with anhandlercalled when the operation completesVoidendAndAwait()Blocking variant ofWriteStream.end().VoidendAndAwait(Buffer data)Blocking variant ofio.vertx.mutiny.core.streams.WriteStream#end(T).voidendAndForget()Variant ofWriteStream.end()that ignores the result of the operation.voidendAndForget(Buffer data)Variant ofio.vertx.mutiny.core.streams.WriteStream#end(T)that ignores the result of the operation.SockJSSocketendHandler(Runnable endHandler)booleanequals(Object o)SockJSSocketexceptionHandler(Consumer<Throwable> handler)SockJSSocketfetch(long amount)io.vertx.ext.web.handler.sockjs.SockJSSocketgetDelegate()SockJSSockethandler(Consumer<Buffer> handler)inthashCode()MultiMapheaders()SocketAddresslocalAddress()static SockJSSocketnewInstance(io.vertx.ext.web.handler.sockjs.SockJSSocket arg)SockJSSocketpause()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.SocketAddressremoteAddress()SockJSSocketresume()RoutingContextroutingContext()SockJSSocketsetWriteQueueMaxSize(int maxSize)Iterable<Buffer>toBlockingIterable()Stream<Buffer>toBlockingStream()io.smallrye.mutiny.Multi<Buffer>toMulti()StringtoString()WriteStreamSubscriber<Buffer>toSubscriber()Stringuri()SessionwebSession()UserwebUser()io.smallrye.mutiny.Uni<Void>write(Buffer data)Same as but with anhandlercalled when the operation completesio.smallrye.mutiny.Uni<Void>write(String data)VoidwriteAndAwait(Buffer data)Blocking variant ofio.vertx.mutiny.core.streams.WriteStream#write(T).VoidwriteAndAwait(String data)voidwriteAndForget(Buffer data)Variant ofio.vertx.mutiny.core.streams.WriteStream#write(T)that ignores the result of the operation.voidwriteAndForget(String data)StringwriteHandlerID()booleanwriteQueueFull()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<SockJSSocket> __TYPE_ARG
-
-
Constructor Detail
-
SockJSSocket
public SockJSSocket(io.vertx.ext.web.handler.sockjs.SockJSSocket delegate)
-
SockJSSocket
public SockJSSocket(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.ext.web.handler.sockjs.SockJSSocket getDelegate()
- Specified by:
getDelegatein interfaceReadStream<Buffer>- Specified by:
getDelegatein interfaceStreamBase- Specified by:
getDelegatein interfaceWriteStream<Buffer>
-
toSubscriber
@CheckReturnValue public WriteStreamSubscriber<Buffer> toSubscriber()
-
end
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> end()
Description copied from interface:WriteStreamSame asWriteStream.end()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>- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
endAndAwait
public Void endAndAwait()
Description copied from interface:WriteStreamBlocking variant ofWriteStream.end().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.
-
endAndForget
public void endAndForget()
Description copied from interface:WriteStreamVariant ofWriteStream.end()that ignores the result of the operation.This method subscribes on the result of
WriteStream.end(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromWriteStream.end()but you don't need to compose it with other operations.- Specified by:
endAndForgetin interfaceWriteStream<Buffer>
-
end
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> end(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:
endin interfaceWriteStream<Buffer>- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
endAndAwait
public Void endAndAwait(Buffer data)
Description copied from interface:WriteStreamBlocking variant ofio.vertx.mutiny.core.streams.WriteStream#end(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:
endAndAwaitin interfaceWriteStream<Buffer>- Returns:
- the Void instance produced by the operation.
-
endAndForget
public void endAndForget(Buffer data)
Description copied from interface:WriteStreamVariant ofio.vertx.mutiny.core.streams.WriteStream#end(T)that ignores the result of the operation.This method subscribes on the result of
io.vertx.mutiny.core.streams.WriteStream#end(T), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromio.vertx.mutiny.core.streams.WriteStream#end(T)but you don't need to compose it with other operations.- Specified by:
endAndForgetin interfaceWriteStream<Buffer>
-
writeQueueFull
public boolean writeQueueFull()
- Specified by:
writeQueueFullin interfaceWriteStream<Buffer>- Returns:
trueif write queue is full
-
pipe
public Pipe<Buffer> pipe()
- Specified by:
pipein interfaceReadStream<Buffer>- Returns:
- a pipe
-
pipeTo
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> pipeTo(WriteStream<Buffer> dst)
Description copied from interface:ReadStreamPipe 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
public Void pipeToAndAwait(WriteStream<Buffer> dst)
Description copied from interface:ReadStreamBlocking 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>- Parameters:
dst- the destination write stream- Returns:
- the Void instance produced by the operation.
-
pipeToAndForget
public void pipeToAndForget(WriteStream<Buffer> dst)
Description copied from interface:ReadStreamVariant 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>- Parameters:
dst- the destination write stream
-
exceptionHandler
public SockJSSocket exceptionHandler(Consumer<Throwable> handler)
- Specified by:
exceptionHandlerin interfaceReadStream<Buffer>- Specified by:
exceptionHandlerin interfaceStreamBase- Specified by:
exceptionHandlerin interfaceWriteStream<Buffer>- Parameters:
handler- the exception handler- Returns:
-
handler
public SockJSSocket handler(Consumer<Buffer> handler)
- Specified by:
handlerin interfaceReadStream<Buffer>- Returns:
-
pause
public SockJSSocket pause()
- Specified by:
pausein interfaceReadStream<Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
resume
public SockJSSocket resume()
- Specified by:
resumein interfaceReadStream<Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
fetch
public SockJSSocket fetch(long amount)
- Specified by:
fetchin interfaceReadStream<Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
public SockJSSocket endHandler(Runnable endHandler)
- Specified by:
endHandlerin interfaceReadStream<Buffer>- Returns:
-
closeHandler
public SockJSSocket closeHandler(Runnable closeHandler)
-
writeAndForget
public void writeAndForget(String data)
-
write
@CheckReturnValue 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 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 interfaceWriteStream<Buffer>- Returns:
- the Void instance produced by the operation.
-
writeAndForget
public void writeAndForget(Buffer data)
Description copied from interface:WriteStreamVariant ofio.vertx.mutiny.core.streams.WriteStream#write(T)that ignores the result of the operation.This method subscribes on the result of
io.vertx.mutiny.core.streams.WriteStream#write(T), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromio.vertx.mutiny.core.streams.WriteStream#write(T)but you don't need to compose it with other operations.- Specified by:
writeAndForgetin interfaceWriteStream<Buffer>
-
setWriteQueueMaxSize
public SockJSSocket 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
public SockJSSocket drainHandler(Runnable handler)
- Specified by:
drainHandlerin interfaceWriteStream<Buffer>- Parameters:
handler- the handler- Returns:
-
writeHandlerID
public String writeHandlerID()
- Returns:
- the
writeHandlerIDornullifwriteHandlerregistration is disabled inSockJSHandlerOptions
-
close
public void close()
-
close
public void close(int statusCode, String reason)- Parameters:
statusCode-reason-
-
remoteAddress
public SocketAddress remoteAddress()
- Returns:
-
localAddress
public SocketAddress localAddress()
- Returns:
-
headers
public MultiMap headers()
- Returns:
-
uri
public String uri()
- Returns:
-
routingContext
public RoutingContext routingContext()
- Returns:
- the Vert.x-Web RoutingContext corresponding to this socket
-
webSession
public Session webSession()
- Returns:
- the Vert.x-Web session corresponding to this socket
-
webUser
public User webUser()
- Returns:
- the Vert.x-Web user corresponding to this socket
-
toMulti
@CheckReturnValue public io.smallrye.mutiny.Multi<Buffer> toMulti()
- Specified by:
toMultiin interfaceReadStream<Buffer>
-
newInstance
public static SockJSSocket newInstance(io.vertx.ext.web.handler.sockjs.SockJSSocket arg)
-
-