Documentation ¶
Index ¶
- type ActionMessage
- type ConnectedMessage
- type CreatedMessage
- type ErrorMessage
- type GameMessage
- type HistoryMessage
- type InviteMessage
- type JoinMessage
- type LeaveMessage
- type LobbyMessage
- type Message
- type RegisterMessage
- type RegisteredMessage
- type StartMessage
- type StateMessage
- type StateMessageOut
- type StopMessage
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 ¶
func NewCreatedMessage ¶
func NewCreatedMessage(game int) *CreatedMessage
type ErrorMessage ¶
func NewErrorMessage ¶
func NewErrorMessage(error string) *ErrorMessage
type GameMessage ¶
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 ¶
func ParseInviteMessage ¶
func ParseInviteMessage(raw []byte) (*InviteMessage, error)
type JoinMessage ¶
func ParseJoinMessage ¶
func ParseJoinMessage(raw []byte) (*JoinMessage, error)
type LeaveMessage ¶
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 RegisterMessage ¶
func ParseRegisterMessage ¶
func ParseRegisterMessage(raw []byte) (*RegisterMessage, error)
type RegisteredMessage ¶
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 ¶
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 ¶
type StopMessage ¶
func NewStopMessage ¶
func NewStopMessage(game int) *StopMessage
func ParseStopMessage ¶
func ParseStopMessage(raw []byte) (*StopMessage, error)
Click to show internal directories.
Click to hide internal directories.