Class ClientConnectionHandler

  • All Implemented Interfaces:
    AutoCloseable

    public abstract class ClientConnectionHandler
    extends Object
    implements AutoCloseable
    Handler for EventStream ClientConnections. It's marked AutoClosable. By default onConnectionClosed, calls the close() function on this object.
    • Constructor Detail

      • ClientConnectionHandler

        public ClientConnectionHandler()
    • Method Detail

      • onConnectionSetup

        protected abstract void onConnectionSetup​(ClientConnection connection,
                                                  int errorCode)
        Invoked upon completion of the Connection attempt
        Parameters:
        connection - if the setup was successful, connection is non-null. On error, errorCode will be non-zero
        errorCode - Error representing any error that occurred during connect.
      • onProtocolMessage

        protected abstract void onProtocolMessage​(List<Header> headers,
                                                  byte[] payload,
                                                  MessageType messageType,
                                                  int messageFlags)
        Invoked when a message is received on a connection.
        Parameters:
        headers - List of EventStream headers for the message received.
        payload - Payload for the message received
        messageType - message type for the message
        messageFlags - message flags for the message
      • getConnectionClosedFuture

        public CompletableFuture<Integer> getConnectionClosedFuture()
        Returns:
        a future for syncing on Connection closed.
      • onConnectionClosed

        protected void onConnectionClosed​(int closeReason)
        Invoked upon the connection closed event. By default it calls close() on this object.
        Parameters:
        closeReason - The reason the connection was closed. 0 means a clean shutdown.