message

package
v0.0.0-...-b083768 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionMessage

type ActionMessage struct {
	Message
	Game   int             `json:"game"`
	Key    string          `json:"key"`    // incoming only
	Player string          `json:"player"` // outgoing only
	Action json.RawMessage `json:"action"`
}

func ParseActionMessage

func ParseActionMessage(raw []byte) (*ActionMessage, error)

type ConnectedMessage

type ConnectedMessage struct {
	Message
}

func NewConnectedMessage

func NewConnectedMessage() *ConnectedMessage

type CreatedMessage

type CreatedMessage struct {
	Message
	Game int `json:"game"`
}

func NewCreatedMessage

func NewCreatedMessage(game int) *CreatedMessage

type ErrorMessage

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

func NewErrorMessage

func NewErrorMessage(error string) *ErrorMessage

type GameMessage

type GameMessage struct {
	Message
	Name   string
	Engine int
}

func ParseGameMessage

func ParseGameMessage(raw []byte) (*GameMessage, error)

type HistoryMessage

type HistoryMessage struct {
	Message
	Messages []*StateMessageOut `json:"messages"`
}

func NewHistoryMessage

func NewHistoryMessage(messages []*StateMessageOut) *HistoryMessage

type InviteMessage

type InviteMessage struct {
	Message
	Game int
	Bot  int
}

func ParseInviteMessage

func ParseInviteMessage(raw []byte) (*InviteMessage, error)

type JoinMessage

type JoinMessage struct {
	Message
	Game int
}

func ParseJoinMessage

func ParseJoinMessage(raw []byte) (*JoinMessage, error)

type LeaveMessage

type LeaveMessage struct {
	Message
	Game int
}

func ParseLeaveMessage

func ParseLeaveMessage(raw []byte) (*LeaveMessage, error)

type LobbyMessage

type LobbyMessage struct {
	Message
	Lobby interface{} `json:"lobby"`
}

func NewLobbyMessage

func NewLobbyMessage(lobby interface{}) *LobbyMessage

type Message

type Message struct {
	Type string `json:"type"`
}

func ParseMessage

func ParseMessage(raw []byte) (*Message, error)

type RegisterMessage

type RegisterMessage struct {
	Message
	ClientType string
	Name       string
	Game       string
}

func ParseRegisterMessage

func ParseRegisterMessage(raw []byte) (*RegisterMessage, error)

type RegisteredMessage

type RegisteredMessage struct {
	Message
	Id int `json:"id"`
}

func NewRegisteredMessage

func NewRegisteredMessage(id int) *RegisteredMessage

type StartMessage

type StartMessage struct {
	Message
	Game    int    `json:"game"`
	Players []int  `json:"players"` // outgoing only
	Prefix  string `json:"prefix"`  // outgoing only
	Suffix  string `json:"suffix"`  // outgoing only
}

func NewStartMessage

func NewStartMessage(game int, players []int, prefix string, suffix string) *StartMessage

func ParseStartMessage

func ParseStartMessage(raw []byte) (*StartMessage, error)

type StateMessage

type StateMessage struct {
	Message
	Game    int
	Turn    int
	Players []string
	State   json.RawMessage
}

func ParseStateMessage

func ParseStateMessage(raw []byte) (*StateMessage, error)

type StateMessageOut

type StateMessageOut struct {
	Message
	Game  int             `json:"game"`
	Key   string          `json:"key"`
	Turn  int             `json:"turn"`
	Move  bool            `json:"move"`
	State json.RawMessage `json:"state"`
}

func NewStateMessageOut

func NewStateMessageOut(game int, key string, turn int, move bool, state string) *StateMessageOut

type StopMessage

type StopMessage struct {
	Message
	Game int `json:"game"`
}

func NewStopMessage

func NewStopMessage(game int) *StopMessage

func ParseStopMessage

func ParseStopMessage(raw []byte) (*StopMessage, error)

Jump to

Keyboard shortcuts

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