socket

package
v0.0.0-...-7a66c0d Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorMessage

type ErrorMessage struct {
	Message string `json:"message"`

	// if Recoverable is false, then the websocket is closed after this
	// message is sent
	Recoverable bool `json:"recoverable"`
}

type IncomingSocketMessage

type IncomingSocketMessage struct {
	Type      string          `json:"messageType"`
	Payload   json.RawMessage `json:"payload"`
	RequestID int             `json:"requestID"`
}

type LoginRequest

type LoginRequest struct {
	LoginID string `json:"loginID"`
}

type LoginSuccess

type LoginSuccess struct {
	Username string            `json:"username"`
	PlayerID string            `json:"playerID"`
	Games    []store.GameState `json:"games"`
}

type NewGame

type NewGame struct {
	OpponentID string `json:"opponentID"`
}

type OutgoingSocketMessage

type OutgoingSocketMessage struct {
	Type      string      `json:"messageType"`
	Payload   interface{} `json:"payload"`
	RequestID int         `json:"requestID"`
}

type PlayMove

type PlayMove struct {
	GameID string    `json:"gameID"`
	Move   game.Move `json:"move"`
}

type Server

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

func NewServer

func NewServer(c *config.Config, gameSvc *store.GameService) *Server

func (*Server) Handle

func (s *Server) Handle(w http.ResponseWriter, r *http.Request)

type UserLookup

type UserLookup struct {
	Username string `json:"username"`
	PlayerID string `json:"playerID"`
}

Jump to

Keyboard shortcuts

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