Class 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 with Pump to pump data with flow control.

    NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

    • Constructor Detail

      • SockJSSocket

        public SockJSSocket​(io.vertx.ext.web.handler.sockjs.SockJSSocket delegate)
      • SockJSSocket

        public SockJSSocket​(Object delegate)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • pipeTo

        public io.smallrye.mutiny.Uni<Void> pipeTo​(WriteStream<Buffer> dst)
        Description copied from interface: ReadStream
        Pipe this ReadStream to the WriteStream.

        Elements emitted by this stream will be written to the write stream until this stream ends or fails.

        Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Specified by:
        pipeTo in interface ReadStream<Buffer>
        Parameters:
        dst - the destination write stream
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • pipeToAndAwait

        public Void pipeToAndAwait​(WriteStream<Buffer> dst)
        Description copied from interface: ReadStream
        Blocking variant of io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Specified by:
        pipeToAndAwait in interface ReadStream<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: ReadStream
        Variant of io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream) that ignores the result of the operation.

        This method subscribes on the result of io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream) but you don't need to compose it with other operations.

        Specified by:
        pipeToAndForget in interface ReadStream<Buffer>
        Parameters:
        dst - the destination write stream
      • end

        public io.smallrye.mutiny.Uni<Void> end()
        Description copied from interface: WriteStream
        Same as WriteStream.end() but with an handler called when the operation completes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Specified by:
        end in interface WriteStream<Buffer>
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • endAndAwait

        public Void endAndAwait()
        Description copied from interface: WriteStream
        Blocking variant of WriteStream.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:
        endAndAwait in interface WriteStream<Buffer>
        Returns:
        the Void instance produced by the operation.
      • endAndForget

        public void endAndForget()
        Description copied from interface: WriteStream
        Variant of WriteStream.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 from WriteStream.end() but you don't need to compose it with other operations.

        Specified by:
        endAndForget in interface WriteStream<Buffer>
      • end

        public io.smallrye.mutiny.Uni<Void> end​(Buffer data)
        Description copied from interface: WriteStream
        Same as but with an handler called when the operation completes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Specified by:
        end in interface WriteStream<Buffer>
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • endAndAwait

        public Void endAndAwait​(Buffer data)
        Description copied from interface: WriteStream
        Blocking variant of io.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:
        endAndAwait in interface WriteStream<Buffer>
        Returns:
        the Void instance produced by the operation.
      • endAndForget

        public void endAndForget​(Buffer data)
        Description copied from interface: WriteStream
        Variant of io.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 from io.vertx.mutiny.core.streams.WriteStream#end(T) but you don't need to compose it with other operations.

        Specified by:
        endAndForget in interface WriteStream<Buffer>
      • fetch

        public SockJSSocket fetch​(long amount)
        Specified by:
        fetch in interface ReadStream<Buffer>
        Returns:
        a reference to this, so the API can be used fluently
      • write

        public io.smallrye.mutiny.Uni<Void> write​(String data)
      • writeAndAwait

        public Void writeAndAwait​(String data)
      • writeAndForget

        public void writeAndForget​(String data)
      • write

        public io.smallrye.mutiny.Uni<Void> write​(Buffer data)
        Description copied from interface: WriteStream
        Same as but with an handler called when the operation completes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Specified by:
        write in interface WriteStream<Buffer>
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • writeAndAwait

        public Void writeAndAwait​(Buffer data)
        Description copied from interface: WriteStream
        Blocking variant of io.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:
        writeAndAwait in interface WriteStream<Buffer>
        Returns:
        the Void instance produced by the operation.
      • writeAndForget

        public void writeAndForget​(Buffer data)
        Description copied from interface: WriteStream
        Variant of io.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 from io.vertx.mutiny.core.streams.WriteStream#write(T) but you don't need to compose it with other operations.

        Specified by:
        writeAndForget in interface WriteStream<Buffer>
      • setWriteQueueMaxSize

        public SockJSSocket setWriteQueueMaxSize​(int maxSize)
        Specified by:
        setWriteQueueMaxSize in interface WriteStream<Buffer>
        Parameters:
        maxSize - the max size of the write stream
        Returns:
        a reference to this, so the API can be used fluently
      • writeHandlerID

        public String writeHandlerID()
        Returns:
        the writeHandlerID or null if writeHandler registration is disabled in SockJSHandlerOptions
      • close

        public void close()
      • close

        public void close​(int statusCode,
                          String reason)
        Parameters:
        statusCode -
        reason -
      • 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
      • toBlockingStream

        public Stream<Buffer> toBlockingStream()
      • newInstance

        public static SockJSSocket newInstance​(io.vertx.ext.web.handler.sockjs.SockJSSocket arg)