RpcSendService
Creates an instance of RpcSendService
with the specified logger factory, serialization mechanism (ProtoBuf), and WebSocket session.
Parameters
Factory for creating logger instances for this service to enable structured logging during communication and debugging.
The ProtoBuf serializer used for encoding and decoding messages.
The WebSocket session over which the RPC requests and responses are transmitted.
This class includes support for the following operations:
Sending an echo message.
Sending fire-and-forget messages (tell).
Sending requests with expected responses (ask).
Querying the status and statistics of a remote actor.
Initiating the shutdown of a remote actor.
Closing the WebSocket session when communication is complete.
The service ensures reliability and data consistency by validating response IDs with the request IDs during each interaction. Any inconsistency raises an error, ensuring the integrity of the communication process.
Additional functionality is provided via a companion object:
Managing a shared RPC message dispatcher that associates responses to their corresponding requests.
Ensuring unique message IDs for requests by maintaining an internal counter with safe concurrent access.
Handling incoming responses sent from the remote side by deserializing and forwarding them to the RPC manager.