delegate-go facilitates communication between the cmd-stream client and server.
It provides implementations of the core.ClientDelegate
and core.ServerDelegate
interfaces, both of which rely on an abstract transport layer for data exchange.
This module allows the server to initialize the client connection by sending a
ServerInfo
byte slice, typically used to indicate a set of supported commands.
Client creation may fail with an error if it's ServerInfo
doen't match the one
received from the server.
Additionally, the client
package includes KeepaliveDelegate
and
ReconnectDelegate
:
KeepaliveDelegate
initiates a ping-pong exchange with the server when no commands are pending. It sends thePing
command and expects thePong
result, both transmitted as a single zero byte (like a ball).ReconnectDelegate
implements thecore.ClientReconnectDelegate
interface, providing aReconnect
method that should be invoked by the client if the connection to the server is lost.