server

package
v0.0.0-...-9a828cc Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MessageHandler

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

func ServeWs

func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request)

serveWs handles websocket requests from the peer.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a middleman between the websocket connection and the hub.

type Game

type Game struct {
	// contains filtered or unexported fields
}

func InitGame

func InitGame(player *commons.Player) (*Game, error)

func (*Game) AddPlayer

func (g *Game) AddPlayer(player *commons.Player)

func (*Game) Play

func (g *Game) Play()

func (*Game) PlayRound

func (g *Game) PlayRound()

func (*Game) PlayTurn

func (g *Game) PlayTurn(turn int)

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

func NewHub

func NewHub() *Hub

func (*Hub) Run

func (h *Hub) Run()

Jump to

Keyboard shortcuts

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