websocket

package
v0.0.0-...-e92921d Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(mux *http.ServeMux)

func JoinGame

func JoinGame(gameId, guestId string) string

func StartGame

func StartGame(gameId, hostId string) (string, string)

Types

type GameRoom

type GameRoom struct {
	GameId    string
	HostId    string
	GuestId   string
	Status    GameStatus
	HostConn  *websocket.Conn
	GuestConn *websocket.Conn
	*reversi.Reversi
}

type GameStatus

type GameStatus string
const (
	StatusWaiting  GameStatus = "waiting"
	StatusStarting GameStatus = "starting"
	StatusPlaying  GameStatus = "playing"
	StatusClosed   GameStatus = "closed"
)

type Point

type Point struct {
	X int `json:"x"`
	Y int `json:"Y"`
}

type SendMessage

type SendMessage struct {
	Type string      `json:"type"`
	Data interface{} `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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