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 aAsyncEndpointServerSpi
endpoint.- Since:
- 2.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
closeSession(java.lang.String sessionId)
Invoked by theAsyncNodeClient
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.void
openSession(java.lang.String sessionId)
Invoked by theAsyncNodeClient
node to open a communication session with the server.void
sendMessage(MessageDto message)
Invoked by theAsyncNodeClient
node to send aMessageDto
to the server.
You have to : Find the opened session using the accessible sessionId value using the methodMessageDto.getSessionId()
on the provided message to send.
-
-
-
Method Detail
-
openSession
void openSession(java.lang.String sessionId)
Invoked by theAsyncNodeClient
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 theAsyncNodeClient
node to send aMessageDto
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
- Find the opened session using the accessible sessionId value using the method
-
closeSession
void closeSession(java.lang.String sessionId)
Invoked by theAsyncNodeClient
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
-
-