Interface StompServerConnection


  • public interface StompServerConnection
    Created by Navid Mitchell on 2019-01-10.
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.String binaryHandlerID()
      When a Websocket is created it automatically registers an event handler with the event bus - the ID of that handler is given by this method.
      void close()
      Closes the connection with the client.
      void fetch​(long amount)
      Fetch the specified amount of elements.
      boolean isSsl()  
      io.vertx.core.net.SocketAddress localAddress()  
      void pause()
      Pause the client from sending data.
      javax.security.cert.X509Certificate[] peerCertificateChain()
      Note: Java SE 5+ recommends to use javax.net.ssl.SSLSession#getPeerCertificates() instead of of javax.net.ssl.SSLSession#getPeerCertificateChain() which this method is based on.
      io.vertx.core.net.SocketAddress remoteAddress()  
      void resume()
      Resume reading, and sets the buffer in flowing mode.
      io.vertx.core.Promise<java.lang.Void> sendError​(java.lang.Throwable throwable)
      Deprecated.
      does not comply to the STOMP spec
      io.vertx.core.Promise<java.lang.Void> sendErrorAndDisconnect​(java.lang.Throwable throwable)
      Sends an error frame to the client and then disconnects the client per the Stomp Spec
      io.vertx.core.Promise<java.lang.Void> sendReceiptIfNeeded​(Frame frame)
      Will send receipt frame acknowledgement to clients when requested by a receipt header
      javax.net.ssl.SSLSession sslSession()  
      java.lang.String textHandlerID()
      When a Websocket is created it automatically registers an event handler with the eventbus, the ID of that handler is given by textHandlerID.
      io.vertx.core.Promise<java.lang.Void> write​(io.vertx.core.buffer.Buffer buffer)
      Writes the given buffer to the socket.
      io.vertx.core.Promise<java.lang.Void> write​(Frame frame)
      Writes the given frame to the socket.
    • Method Detail

      • binaryHandlerID

        java.lang.String binaryHandlerID()
        When a Websocket is created it automatically registers an event handler with the event bus - the ID of that handler is given by this method. Given this ID, a different event loop can send a binary frame to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying connection. This allows you to write data to other WebSockets which are owned by different event loops.
        Returns:
        the binary handler id
      • textHandlerID

        java.lang.String textHandlerID()
        When a Websocket is created it automatically registers an event handler with the eventbus, the ID of that handler is given by textHandlerID. Given this ID, a different event loop can send a text frame to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying connection. This allows you to write data to other WebSockets which are owned by different event loops.
        Returns:
        the text handler id
      • remoteAddress

        io.vertx.core.net.SocketAddress remoteAddress()
        Returns:
        the remote address for this socket
      • localAddress

        io.vertx.core.net.SocketAddress localAddress()
        Returns:
        the local address for this socket
      • isSsl

        boolean isSsl()
        Returns:
        true if this HttpConnection is encrypted via SSL/TLS.
      • sslSession

        javax.net.ssl.SSLSession sslSession()
        Returns:
        SSLSession associated with the underlying socket. Returns null if connection is not SSL.
        See Also:
        SSLSession
      • peerCertificateChain

        javax.security.cert.X509Certificate[] peerCertificateChain()
                                                            throws javax.net.ssl.SSLPeerUnverifiedException
        Note: Java SE 5+ recommends to use javax.net.ssl.SSLSession#getPeerCertificates() instead of of javax.net.ssl.SSLSession#getPeerCertificateChain() which this method is based on. Use sslSession() to access that method.
        Returns:
        an ordered array of the peer certificates. Returns null if connection is not SSL.
        Throws:
        javax.net.ssl.SSLPeerUnverifiedException - SSL peer's identity has not been verified.
        See Also:
        SSLSession.getPeerCertificateChain(), sslSession()
      • write

        io.vertx.core.Promise<java.lang.Void> write​(Frame frame)
        Writes the given frame to the socket.
        Parameters:
        frame - the frame, must not be null.
        Returns:
        a Promise that will be completed when the data is successfully sent. Will be failed if there is a problem sending the data or the underlying TCP connection is already closed.
      • write

        io.vertx.core.Promise<java.lang.Void> write​(io.vertx.core.buffer.Buffer buffer)
        Writes the given buffer to the socket. This is a low level API that should be used carefully.
        Parameters:
        buffer - the buffer
        Returns:
        a Promise that will be completed when the data is successfully sent. Will be failed if there is a problem sending the data or the underlying TCP connection is already closed.
      • sendReceiptIfNeeded

        io.vertx.core.Promise<java.lang.Void> sendReceiptIfNeeded​(Frame frame)
        Will send receipt frame acknowledgement to clients when requested by a receipt header
        Parameters:
        frame - to check for a receipt header
        Returns:
        a Promise that will be completed when the data is successfully sent. Will be failed if there is a problem sending the data or the underlying TCP connection is already closed.
      • sendError

        @Deprecated(since="3.9.17")
        io.vertx.core.Promise<java.lang.Void> sendError​(java.lang.Throwable throwable)
        Deprecated.
        does not comply to the STOMP spec
        Sends an error frame to the client and leaves the client connected
        Parameters:
        throwable - the error that occurred
        Returns:
        a Promise that will be completed when the data is successfully sent. Will be failed if there is a problem sending the data or the underlying TCP connection is already closed.
      • sendErrorAndDisconnect

        io.vertx.core.Promise<java.lang.Void> sendErrorAndDisconnect​(java.lang.Throwable throwable)
        Sends an error frame to the client and then disconnects the client per the Stomp Spec
        Parameters:
        throwable - the error that occurred
        Returns:
        a Promise that will be completed when the data is successfully sent. Will be failed if there is a problem sending the data or the underlying TCP connection is already closed.
      • pause

        void pause()
        Pause the client from sending data. it sets the buffer in fetch mode and clears the actual demand. While it's paused, no data will be sent to the data StompServerHandler.
      • resume

        void resume()
        Resume reading, and sets the buffer in flowing mode. If this has been paused, data receiving recommence on it.
      • fetch

        void fetch​(long amount)
        Fetch the specified amount of elements. If this has been paused, reading will recommence with the specified amount of items, otherwise the specified amount will be added to the current client demand.
        Parameters:
        amount - to fetch
      • close

        void close()
        Closes the connection with the client.