delegate-go facilitates communication between the cmd-stream client and server.
It includes implementations of the base.ClientDelegate
and base.ServerDelegate
interfaces, each of which relies on an abstract transport for data delivery.
This module allows the server to initialize the client connection by sending
ServerInfo
- a byte slice that, for example, may denote a set of supported
Commands. If the client's ServerInfo
does not match the one received from the
server, client creation will fail with an error.
Additionally, the client
package provides KeepaliveDelegate
and
ReconnectDelegate
:
KeepaliveDelegate
initiates a Ping-Pong exchange with the server when there are no Commands to send - it sends thePing
Command and receives thePong
result, both transmitted as a single zero byte (like a ball).ReconnectDelegate
implements thebase.ClientReconnectDelegate
interface, providing aReconnect
method that the client should invoke if the connection to the server is lost.