Documentation ¶
Index ¶
- Constants
- func DecodeMessage(data []byte) (interface{}, error)
- func SendGameEndMessage(result gobang.GameProgressResult, gobang *gobang.Gobang) []byte
- func SendGameStartMessage(gobang *gobang.Gobang) []byte
- func SendNextTurnMessage(gobang *gobang.Gobang) []byte
- func SendPutFailedMessage(reason error) []byte
- type App
- type CurrentGame
- type GameContainer
- type GameResult
- type GameStartMessage
- type OutgoingMessage
- type ReceiveMessage
- type SelectCellMessage
- type UnkownMessageError
Constants ¶
View Source
const ( GameStart = "start" SelectCell = "selectCell" NexTurn = "nextTurn" GameEnd = "finish" PutFailed = "putFailed" )
Variables ¶
This section is empty.
Functions ¶
func DecodeMessage ¶
func SendGameEndMessage ¶
func SendGameEndMessage(result gobang.GameProgressResult, gobang *gobang.Gobang) []byte
func SendGameStartMessage ¶
func SendNextTurnMessage ¶
func SendPutFailedMessage ¶
Types ¶
type App ¶
type App struct { *melody.Melody *logrus.Logger *GameContainer }
func (*App) OnDisconnect ¶
type CurrentGame ¶
type GameContainer ¶
type GameContainer struct {
// contains filtered or unexported fields
}
func NewGameContainer ¶
func NewGameContainer() *GameContainer
func (*GameContainer) Register ¶
func (c *GameContainer) Register(s *melody.Session, game *gobang.Gobang)
func (*GameContainer) Unregister ¶
func (c *GameContainer) Unregister(s *melody.Session)
type GameResult ¶
type GameResult struct { Game *gobang.Gobang `json:"game"` Result gobang.GameProgressResult `json:"result"` }
type GameStartMessage ¶
type OutgoingMessage ¶
type OutgoingMessage struct { Type string `json:"type"` Body interface{} `json:"body"` }
type ReceiveMessage ¶
type ReceiveMessage struct { Type string `json:"type"` Body json.RawMessage `json:"body"` }
type SelectCellMessage ¶
type UnkownMessageError ¶
type UnkownMessageError struct {
*ReceiveMessage
}
func (*UnkownMessageError) Error ¶
func (msg *UnkownMessageError) Error() string
Click to show internal directories.
Click to hide internal directories.