Documentation
¶
Index ¶
Constants ¶
View Source
const WSWait = 20 * time.Second
Variables ¶
View Source
var ( EmptyPacket = WSPacket{} HeartbeatPacket = WSPacket{ID: "heartbeat"} )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Done chan struct{} // contains filtered or unexported fields }
func (*Client) Heartbeat ¶
func (c *Client) Heartbeat()
Heartbeat maintains connection to coordinator. Blocking.
func (*Client) Receive ¶
func (c *Client) Receive(id string, f PacketHandler)
Receive receive and response back
type PacketHandler ¶ added in v2.4.0
type WSPacket ¶
type WSPacket struct { ID string `json:"id"` // TODO: Make Data generic: map[string]interface{} for more usecases Data string `json:"data"` RoomID string `json:"room_id"` PlayerIndex int `json:"player_index"` PacketID string `json:"packet_id"` // Globally ID of a browser session SessionID string `json:"session_id"` }
Click to show internal directories.
Click to hide internal directories.