Documentation ¶
Rendered for js/wasm
Overview ¶
Package socket contains the logic to communicate with the server for the game via websocket communication
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DOM ¶ added in v1.2.0
type DOM interface { QuerySelector(query string) js.Value QuerySelectorAll(document js.Value, query string) []js.Value SetChecked(query string, checked bool) NewWebSocket(url string) js.Value EncodeURIComponent(str string) string NewJsFunc(fn func()) js.Func NewJsEventFunc(fn func(event js.Value)) js.Func AlertOnPanic() }
DOM interacts with the page.
type Game ¶
type Game interface { // ID is the id for the game. ID() game.ID // Leave removes the user from his current game. Leave() // UpdateInfo updates the game for the specified message. UpdateInfo(m message.Message) }
Game is the game the user is currently playing.
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
Socket can be used to easily push and pull messages from the server.
func (*Socket) Connect ¶
Connect establishes the websocket connection if it has not yet been established.
Click to show internal directories.
Click to hide internal directories.