Class WebSocketConnection

  • All Implemented Interfaces:
    io.vertx.core.http.ServerWebSocket, io.vertx.core.http.WebSocketBase, io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>, io.vertx.core.streams.StreamBase, io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>

    public class WebSocketConnection
    extends Object
    implements io.vertx.core.http.ServerWebSocket
    • Constructor Detail

      • WebSocketConnection

        public WebSocketConnection​(Request request,
                                   io.vertx.core.Handler<? super WebSocketMessage> handler)
    • Method Detail

      • request

        public Request request()
        Retrieve the Irked Request object that originated this WebSocket connection
        Returns:
        Irked HTTP request routing context wrapper
      • write

        public io.vertx.core.Future<Void> write​(io.vertx.core.buffer.Buffer data)
        Specified by:
        write in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
        See Also:
        WriteStream.write(java.lang.Object)
      • exceptionHandler

        public io.vertx.core.http.ServerWebSocket exceptionHandler​(io.vertx.core.Handler<Throwable> handler)
        Specified by:
        exceptionHandler in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
        Specified by:
        exceptionHandler in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        exceptionHandler in interface io.vertx.core.streams.StreamBase
        Specified by:
        exceptionHandler in interface io.vertx.core.http.WebSocketBase
        Specified by:
        exceptionHandler in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
        See Also:
        ServerWebSocket.exceptionHandler(io.vertx.core.Handler)
      • handler

        public io.vertx.core.http.ServerWebSocket handler​(io.vertx.core.Handler<io.vertx.core.buffer.Buffer> handler)
        Specified by:
        handler in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
        Specified by:
        handler in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        handler in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.handler(io.vertx.core.Handler)
      • pause

        public io.vertx.core.http.ServerWebSocket pause()
        Specified by:
        pause in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
        Specified by:
        pause in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        pause in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.pause()
      • resume

        public io.vertx.core.http.ServerWebSocket resume()
        Specified by:
        resume in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
        Specified by:
        resume in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        resume in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.resume()
      • fetch

        public io.vertx.core.http.ServerWebSocket fetch​(long amount)
        Specified by:
        fetch in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
        Specified by:
        fetch in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        fetch in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.fetch(long)
      • endHandler

        public io.vertx.core.http.ServerWebSocket endHandler​(io.vertx.core.Handler<Void> endHandler)
        Specified by:
        endHandler in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
        Specified by:
        endHandler in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        endHandler in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.endHandler(io.vertx.core.Handler)
      • setWriteQueueMaxSize

        public io.vertx.core.http.ServerWebSocket setWriteQueueMaxSize​(int maxSize)
        Specified by:
        setWriteQueueMaxSize in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        setWriteQueueMaxSize in interface io.vertx.core.http.WebSocketBase
        Specified by:
        setWriteQueueMaxSize in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
        See Also:
        ServerWebSocket.setWriteQueueMaxSize(int)
      • binaryHandlerID

        public String binaryHandlerID()
        Specified by:
        binaryHandlerID in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.binaryHandlerID()
      • drainHandler

        public io.vertx.core.http.ServerWebSocket drainHandler​(io.vertx.core.Handler<Void> handler)
        Specified by:
        drainHandler in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        drainHandler in interface io.vertx.core.http.WebSocketBase
        Specified by:
        drainHandler in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
        See Also:
        ServerWebSocket.drainHandler(io.vertx.core.Handler)
      • write

        public void write​(io.vertx.core.buffer.Buffer data,
                          io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        write in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
        See Also:
        WriteStream.write(java.lang.Object, io.vertx.core.Handler)
      • writeFrame

        public io.vertx.core.http.ServerWebSocket writeFrame​(io.vertx.core.http.WebSocketFrame frame,
                                                             io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        writeFrame in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        writeFrame in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.writeFrame(io.vertx.core.http.WebSocketFrame, io.vertx.core.Handler)
      • writeFinalTextFrame

        public io.vertx.core.http.ServerWebSocket writeFinalTextFrame​(String text,
                                                                      io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        writeFinalTextFrame in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        writeFinalTextFrame in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.writeFinalTextFrame(java.lang.String, io.vertx.core.Handler)
      • writeFinalBinaryFrame

        public io.vertx.core.http.ServerWebSocket writeFinalBinaryFrame​(io.vertx.core.buffer.Buffer data,
                                                                        io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        writeFinalBinaryFrame in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        writeFinalBinaryFrame in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.writeFinalBinaryFrame(io.vertx.core.buffer.Buffer, io.vertx.core.Handler)
      • writeBinaryMessage

        public io.vertx.core.http.ServerWebSocket writeBinaryMessage​(io.vertx.core.buffer.Buffer data,
                                                                     io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        writeBinaryMessage in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        writeBinaryMessage in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.writeBinaryMessage(io.vertx.core.buffer.Buffer, io.vertx.core.Handler)
      • writeTextMessage

        public io.vertx.core.http.ServerWebSocket writeTextMessage​(String text,
                                                                   io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        writeTextMessage in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        writeTextMessage in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.writeTextMessage(java.lang.String, io.vertx.core.Handler)
      • closeHandler

        public io.vertx.core.http.ServerWebSocket closeHandler​(io.vertx.core.Handler<Void> handler)
        Specified by:
        closeHandler in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        closeHandler in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.closeHandler(io.vertx.core.Handler)
      • textHandlerID

        public String textHandlerID()
        Specified by:
        textHandlerID in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.textHandlerID()
      • end

        public io.vertx.core.Future<Void> end​(io.vertx.core.buffer.Buffer data)
        Specified by:
        end in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
        See Also:
        WriteStream.end(java.lang.Object)
      • frameHandler

        public io.vertx.core.http.ServerWebSocket frameHandler​(io.vertx.core.Handler<io.vertx.core.http.WebSocketFrame> handler)
        Specified by:
        frameHandler in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        frameHandler in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.frameHandler(io.vertx.core.Handler)
      • uri

        public String uri()
        Specified by:
        uri in interface io.vertx.core.http.ServerWebSocket
        See Also:
        ServerWebSocket.uri()
      • path

        public String path()
        Specified by:
        path in interface io.vertx.core.http.ServerWebSocket
        See Also:
        ServerWebSocket.path()
      • query

        public String query()
        Specified by:
        query in interface io.vertx.core.http.ServerWebSocket
        See Also:
        ServerWebSocket.query()
      • accept

        public void accept()
        Specified by:
        accept in interface io.vertx.core.http.ServerWebSocket
        See Also:
        ServerWebSocket.accept()
      • subProtocol

        public String subProtocol()
        Specified by:
        subProtocol in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.subProtocol()
      • end

        public void end​(io.vertx.core.buffer.Buffer data,
                        io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        end in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
        See Also:
        WriteStream.end(java.lang.Object, io.vertx.core.Handler)
      • reject

        public void reject()
        Specified by:
        reject in interface io.vertx.core.http.ServerWebSocket
        See Also:
        ServerWebSocket.reject()
      • closeStatusCode

        public Short closeStatusCode()
        Specified by:
        closeStatusCode in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.closeStatusCode()
      • closeReason

        public String closeReason()
        Specified by:
        closeReason in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.closeReason()
      • headers

        public io.vertx.core.MultiMap headers()
        Specified by:
        headers in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.headers()
      • reject

        public void reject​(int status)
        Specified by:
        reject in interface io.vertx.core.http.ServerWebSocket
        See Also:
        ServerWebSocket.reject(int)
      • pipe

        public io.vertx.core.streams.Pipe<io.vertx.core.buffer.Buffer> pipe()
        Specified by:
        pipe in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
        See Also:
        ReadStream.pipe()
      • setHandshake

        public void setHandshake​(io.vertx.core.Future<Integer> future,
                                 io.vertx.core.Handler<io.vertx.core.AsyncResult<Integer>> handler)
        Specified by:
        setHandshake in interface io.vertx.core.http.ServerWebSocket
        See Also:
        ServerWebSocket.setHandshake(io.vertx.core.Future, io.vertx.core.Handler)
      • writeFrame

        public io.vertx.core.Future<Void> writeFrame​(io.vertx.core.http.WebSocketFrame frame)
        Specified by:
        writeFrame in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.writeFrame(io.vertx.core.http.WebSocketFrame)
      • pipeTo

        public io.vertx.core.Future<Void> pipeTo​(io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer> dst)
        Specified by:
        pipeTo in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
        See Also:
        ReadStream.pipeTo(io.vertx.core.streams.WriteStream)
      • writeQueueFull

        public boolean writeQueueFull()
        Specified by:
        writeQueueFull in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
        See Also:
        WriteStream.writeQueueFull()
      • writeFinalTextFrame

        public io.vertx.core.Future<Void> writeFinalTextFrame​(String text)
        Specified by:
        writeFinalTextFrame in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.writeFinalTextFrame(java.lang.String)
      • pipeTo

        public void pipeTo​(io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer> dst,
                           io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        pipeTo in interface io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
        See Also:
        ReadStream.pipeTo(io.vertx.core.streams.WriteStream, io.vertx.core.Handler)
      • writeFinalBinaryFrame

        public io.vertx.core.Future<Void> writeFinalBinaryFrame​(io.vertx.core.buffer.Buffer data)
        Specified by:
        writeFinalBinaryFrame in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.writeFinalBinaryFrame(io.vertx.core.buffer.Buffer)
      • setHandshake

        public io.vertx.core.Future<Integer> setHandshake​(io.vertx.core.Future<Integer> future)
        Specified by:
        setHandshake in interface io.vertx.core.http.ServerWebSocket
        See Also:
        ServerWebSocket.setHandshake(io.vertx.core.Future)
      • writeBinaryMessage

        public io.vertx.core.Future<Void> writeBinaryMessage​(io.vertx.core.buffer.Buffer data)
        Specified by:
        writeBinaryMessage in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.writeBinaryMessage(io.vertx.core.buffer.Buffer)
      • close

        public io.vertx.core.Future<Void> close()
        Specified by:
        close in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        close in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.close()
      • sslSession

        public SSLSession sslSession()
        Specified by:
        sslSession in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        sslSession in interface io.vertx.core.http.WebSocketBase
        See Also:
        ServerWebSocket.sslSession()
      • writeTextMessage

        public io.vertx.core.Future<Void> writeTextMessage​(String text)
        Specified by:
        writeTextMessage in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.writeTextMessage(java.lang.String)
      • writePing

        public WebSocketConnection writePing​(io.vertx.core.buffer.Buffer data,
                                             io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        writePing in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        writePing in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.writePing(io.vertx.core.buffer.Buffer, io.vertx.core.Handler)
      • writePing

        public io.vertx.core.Future<Void> writePing​(io.vertx.core.buffer.Buffer data)
        Specified by:
        writePing in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.writePing(io.vertx.core.buffer.Buffer)
      • writePong

        public WebSocketConnection writePong​(io.vertx.core.buffer.Buffer data,
                                             io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        writePong in interface io.vertx.core.http.ServerWebSocket
        Specified by:
        writePong in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.writePong(io.vertx.core.buffer.Buffer, io.vertx.core.Handler)
      • writePong

        public io.vertx.core.Future<Void> writePong​(io.vertx.core.buffer.Buffer data)
        Specified by:
        writePong in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.writePong(io.vertx.core.buffer.Buffer)
      • textMessageHandler

        public io.vertx.core.http.WebSocketBase textMessageHandler​(io.vertx.core.Handler<String> handler)
        Specified by:
        textMessageHandler in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.textMessageHandler(io.vertx.core.Handler)
      • binaryMessageHandler

        public io.vertx.core.http.WebSocketBase binaryMessageHandler​(io.vertx.core.Handler<io.vertx.core.buffer.Buffer> handler)
        Specified by:
        binaryMessageHandler in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.binaryMessageHandler(io.vertx.core.Handler)
      • pongHandler

        public io.vertx.core.http.WebSocketBase pongHandler​(io.vertx.core.Handler<io.vertx.core.buffer.Buffer> handler)
        Specified by:
        pongHandler in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.pongHandler(io.vertx.core.Handler)
      • end

        public io.vertx.core.Future<Void> end()
        Specified by:
        end in interface io.vertx.core.http.WebSocketBase
        Specified by:
        end in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
        See Also:
        WebSocketBase.end()
      • end

        public void end​(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        end in interface io.vertx.core.http.WebSocketBase
        Specified by:
        end in interface io.vertx.core.streams.WriteStream<io.vertx.core.buffer.Buffer>
        See Also:
        WebSocketBase.end(io.vertx.core.Handler)
      • close

        public void close​(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        close in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.close(io.vertx.core.Handler)
      • close

        public io.vertx.core.Future<Void> close​(short statusCode)
        Specified by:
        close in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.close(short)
      • close

        public void close​(short statusCode,
                          io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        close in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.close(short, io.vertx.core.Handler)
      • close

        public io.vertx.core.Future<Void> close​(short statusCode,
                                                String reason)
        Specified by:
        close in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.close(short, java.lang.String)
      • close

        public void close​(short statusCode,
                          String reason,
                          io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> handler)
        Specified by:
        close in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.close(short, java.lang.String, io.vertx.core.Handler)
      • remoteAddress

        public io.vertx.core.net.SocketAddress remoteAddress()
        Specified by:
        remoteAddress in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.remoteAddress()
      • localAddress

        public io.vertx.core.net.SocketAddress localAddress()
        Specified by:
        localAddress in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.localAddress()
      • isSsl

        public boolean isSsl()
        Specified by:
        isSsl in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.isSsl()
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface io.vertx.core.http.WebSocketBase
        See Also:
        WebSocketBase.isClosed()
      • scheme

        public String scheme()
        Specified by:
        scheme in interface io.vertx.core.http.ServerWebSocket
        See Also:
        ServerWebSocket.scheme()
      • host

        public String host()
        Specified by:
        host in interface io.vertx.core.http.ServerWebSocket
        See Also:
        ServerWebSocket.host()
      • authority

        public io.vertx.core.net.HostAndPort authority()
        Specified by:
        authority in interface io.vertx.core.http.ServerWebSocket