Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConnectionRequest ¶ added in v2.6.0
func GetConnectionRequest(data string) (api.ConnectionRequest, error)
func NewHTTPServer ¶ added in v2.6.0
Types ¶
type BrowserClient ¶
type BrowserClient struct { *cws.Client SessionID string RoomID string WorkerID string // TODO: how about pointer to workerClient? }
func NewBrowserClient ¶
func NewBrowserClient(c *websocket.Conn, browserID string) *BrowserClient
NewCoordinatorClient returns a client connecting to browser. This connection exchanges information between browser and coordinator.
func (*BrowserClient) Printf ¶
func (bc *BrowserClient) Printf(format string, args ...interface{})
Register new log
func (*BrowserClient) Println ¶
func (bc *BrowserClient) Println(args ...interface{})
type Server ¶
func NewServer ¶
func NewServer(cfg coordinator.Config, library games.GameLibrary) *Server
type WorkerClient ¶
type WorkerClient struct { *cws.Client WorkerID string Address string // ip address of worker // public server used for ping check PingServer string StunTurnServer string Zone string // contains filtered or unexported fields }
func NewWorkerClient ¶
func NewWorkerClient(c *websocket.Conn, workerID string) *WorkerClient
NewWorkerClient returns a client connecting to worker. This connection exchanges information between workers and server.
func (*WorkerClient) ChangeUserQuantityBy ¶ added in v2.6.0
func (wc *WorkerClient) ChangeUserQuantityBy(n int)
ChangeUserQuantityBy increases or decreases the total amount of users connected to the current worker. We count users to determine when the worker becomes new game ready.
func (*WorkerClient) HasGameSlot ¶ added in v2.6.0
func (wc *WorkerClient) HasGameSlot() bool
HasGameSlot tells whether the current worker has a free slot to start a new game. Workers support only one game at a time.
func (*WorkerClient) Printf ¶
func (wc *WorkerClient) Printf(format string, args ...interface{})
func (*WorkerClient) Println ¶
func (wc *WorkerClient) Println(args ...interface{})
Click to show internal directories.
Click to hide internal directories.