server

package
v0.0.0-...-411b84e Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind(cid int, uid string)

func BroadCast

func BroadCast(roomId int, msg WsMessage, exclude int)

func CanStartGame

func CanStartGame(rid int) bool

func CreateRoom

func CreateRoom(seatSum int, gameSum int) *data.Room

func EnterRoom

func EnterRoom(pUser *data.User, pRoom *data.Room, seat int)

func GuessRight

func GuessRight(rid int, guesserSeat int)

func IsOnlie

func IsOnlie(uid string) bool

func LeaveUser

func LeaveUser(rid int, uid string)

func OnClientConnect

func OnClientConnect(c echo.Context) error

func OverGame

func OverGame(rid int)

func Send

func Send(cid int, data WsMessage)

func StartGame

func StartGame(rid int)

Types

type Client

type Client struct {
	Cid  int
	Uid  string
	Conn *websocket.Conn
}

type ErrorData

type ErrorData struct {
	ErrorCode    int    `json:"errorcode"`
	ErrorMessage string `json:"errormessage"`
}

type Response

type Response struct {
	Data  interface{} `json:"data"`
	Error interface{} `json:"error"`
}

type Token

type Token struct {
	Token string `json:"token"`
}

type UserData

type UserData struct {
	Uid      string `json:"uid"`
	Username string `json:"username"`
	Token    string `json:"token"`
}

type WsMessage

type WsMessage struct {
	Name  string      `json:"name"`
	Value interface{} `json:"value"`
}

Jump to

Keyboard shortcuts

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