Versions in this module Expand all Collapse all v0 v0.3.0 Dec 31, 2023 Changes in this version + func GenerateCert(cert TLSCert) + type ClientMessage struct + Data any + Token string + Type string + Username string + type CurrentQuestion struct + Answer any + Choices []string + Question string + Responses int + Weight int + type Game struct + Benched GamePlayers + Key middleware.APIKey + Name string + Players GamePlayers + func NewGame(name string, tokenExpiration float64) *Game + func (g *Game) Bench(p *Player) error + func (g *Game) CheckTokenExpiration() error + func (g *Game) GetPlayer(v any) (*Player, error) + func (g *Game) GetScoreboard() Scoreboard + func (g *Game) HasPlayer(name string) (*Player, bool) + func (g *Game) Unbench(p *Player) error + func (g *Game) UpdatePlayerScore(socket *websocket.Conn, points int) (int, error) + type GamePlayers []*Player + type Player struct + Location string + Name string + Score int + Socket *websocket.Conn + UUID string + type PlayerScore struct + Name string + Score int + type Scoreboard []*PlayerScore + func (s Scoreboard) Len() int + func (s Scoreboard) Less(i, j int) bool + func (s Scoreboard) Swap(i, j int) + type ServerMessage struct + Data any + Type string + type Socket struct + Domain string + Port int + Protocol string + func (s Socket) String() string + type SocketServer struct + Games map[string]*Game + Location URL + Mux *http.ServeMux + Tpl *template.Template + func NewSocketServer(url URL) *SocketServer + func (s *SocketServer) BaseHandler(w http.ResponseWriter, r *http.Request) + func (s *SocketServer) DefaultHandler(socket *websocket.Conn) + func (s *SocketServer) GetGame(key string) (*Game, error) + func (s *SocketServer) GetPlayerBySocket(socket *websocket.Conn) (*Player, *Game, error) + func (s *SocketServer) HealthHandler(w http.ResponseWriter, r *http.Request) + func (s *SocketServer) KillHandler(w http.ResponseWriter, r *http.Request) + func (s *SocketServer) Message(socket *websocket.Conn, msg ServerMessage) error + func (s *SocketServer) MessageHandler(w http.ResponseWriter, r *http.Request) + func (s *SocketServer) NotifyHandler(w http.ResponseWriter, r *http.Request) + func (s *SocketServer) Publish(game *Game, msg ServerMessage) error + func (s *SocketServer) QueryHandler(w http.ResponseWriter, r *http.Request) + func (s *SocketServer) RegisterAndStartGame(game *Game) + func (s *SocketServer) RegisterGame(game *Game) + func (s *SocketServer) ResetHandler(w http.ResponseWriter, r *http.Request) + func (s *SocketServer) ScoreboardHandler(w http.ResponseWriter, r *http.Request) + func (s *SocketServer) StartGame(game *Game) + func (s *SocketServer) UpdateScoreHandler(w http.ResponseWriter, r *http.Request) + type TLSCert struct + EcdsaCurve string + Ed25519Key bool + Host string + IsCA bool + RsaBits int + ValidFor time.Duration + ValidFrom string + type URL struct + Path string + Sock Socket + func (u URL) String() string