Documentation
¶
Index ¶
- Constants
- func GetSessionID(surl string) (string, error)
- func Reset(ctx context.Context, c *websocket.Conn) error
- func Reveal(ctx context.Context, c *websocket.Conn, k string, v interface{}) error
- func SendState(ctx context.Context, c *websocket.Conn, s State) error
- func UpdateUser(ctx context.Context, c *websocket.Conn, k string, v interface{}) error
- func UpdateWorld(ctx context.Context, c *websocket.Conn, k string, v interface{}) error
- type State
- type Update
Constants ¶
View Source
const ( WorldUpdate = iota UserUpdate ResetUpdate RevealUpdate )
Variables ¶
This section is empty.
Functions ¶
func GetSessionID ¶
GetSessionID is used to retrieve the session ID from a given ploker URL.
func Reset ¶
Reset is used by clients. It sends a reset update to the server, causing the server to reset all state for the session.
func Reveal ¶
Reveal is used by clients. It sends a "reveal" update to the server, causing the server to count down visually for all clients before setting k = v in the world state.
func UpdateUser ¶
UpdateUser is used by clients. It sends an update over connection c, telling the server to update the client state associated with its websocket, setting k = v.
Types ¶
type State ¶
type State struct {
// client id -> client state
Clients map[uint32]map[string]interface{}
World map[string]interface{}
}
State keeps track of the world state. Clients map client ID to client state. World keeps track of global state for a session.
Click to show internal directories.
Click to hide internal directories.