Interface AsyncEndpointClientSpi


  • public interface AsyncEndpointClientSpi
    SPI of the client endpoint using an asynchronous network protocol.

    You must provide an implementation of this interface if you plan to use a full duplex communication protocol, such as Web Sockets for example.

    This endpoint interacts locally with a AsyncNodeClient node and remotely with a AsyncEndpointServerSpi endpoint.

    Since:
    2.0.0
    • Method Detail

      • openSession

        void openSession​(java.lang.String sessionId)
        Invoked by the AsyncNodeClient node to open a communication session with the server.
        Following the opening of the session you must :
        • Associate the session with the provided sessionId in order to be able to retrieve the session later.
        • Retrieve the AsyncNodeClient node using the getAsyncNode() method of the associated distributed component, depending on your use case.
        • Invoke the method AsyncNodeClient.onOpen(String) on the node.
        Parameters:
        sessionId - The session id.
        Since:
        2.0.0
      • sendMessage

        void sendMessage​(MessageDto message)
        Invoked by the AsyncNodeClient node to send a MessageDto to the server.
        You have to :
        • Find the opened session using the accessible sessionId value using the method MessageDto.getSessionId() on the provided message to send.
        • Serialize and send the MessageDto to the server.
        Parameters:
        message - The message to send.
        Since:
        2.0.0
      • closeSession

        void closeSession​(java.lang.String sessionId)
        Invoked by the AsyncNodeClient node to close a communication session with the server identified by the provided sessionId.
        Following the closing of the session you must :
        • Unregister the session associated to the provided sessionId.
        • Retrieve the AsyncNodeClient node using the getAsyncNode() method of the associated distributed component, depending on your use case.
        • Call the method AsyncNodeClient.onClose(String) on the node.
        Parameters:
        sessionId - The session id.
        Since:
        2.0.0