communication

package
v0.0.0-...-1b9c3da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DrawingBoardBaseWidth  = 1600
	DrawingBoardBaseHeight = 900
)

Variables

This section is empty.

Functions

func GetPlayers

func GetPlayers(w http.ResponseWriter, r *http.Request)

GetPlayers returns divs for all players in the lobby to the calling client.

func GetRounds

func GetRounds(w http.ResponseWriter, r *http.Request)

GetRounds returns the html structure and data for the current round info.

func GetWordHint

func GetWordHint(w http.ResponseWriter, r *http.Request)

GetWordHint returns the html structure and data for the current word hint.

func SendDataToConnectedPlayers

func SendDataToConnectedPlayers(sender *game.Player, lobby *game.Lobby, data interface{})

func Serve

func Serve(port int) error

func TriggerComplexUpdateEvent

func TriggerComplexUpdateEvent(eventType string, data interface{}, lobby *game.Lobby)

func TriggerComplexUpdatePerPlayerEvent

func TriggerComplexUpdatePerPlayerEvent(eventType string, data func(*game.Player) interface{}, lobby *game.Lobby)

func TriggerSimpleUpdateEvent

func TriggerSimpleUpdateEvent(eventType string, lobby *game.Lobby)

func WriteAsJSON

func WriteAsJSON(player *game.Player, object interface{}) error

WriteAsJSON marshals the given input into a JSON string and sends it to the player using the currently established websocket connection.

func WritePublicSystemMessage

func WritePublicSystemMessage(lobby *game.Lobby, text string)

Types

type CreatePageData

type CreatePageData struct {
	*game.SettingBounds
	Errors            []string
	Languages         map[string]string
	DrawingTime       string
	Rounds            string
	MaxPlayers        string
	CustomWords       string
	CustomWordsChance string
	ClientsPerIPLimit string
	EnableVotekick    string
	Language          string
}

CreatePageData defines all non-static data for the lobby create page.

type LobbyData

type LobbyData struct {
	LobbyID                string `json:"lobbyId"`
	DrawingBoardBaseWidth  int    `json:"drawingBoardBaseWidth"`
	DrawingBoardBaseHeight int    `json:"drawingBoardBaseHeight"`
}

LobbyData is the data necessary for initially displaying all data of the lobbies webpage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL