Documentation ¶
Index ¶
- Constants
- Variables
- func Clients() *clients
- func NewClients() *clients
- func NewRooms() *rooms
- func NewUsers() *users
- func Rooms() *rooms
- func Run()
- func SendMessage(msg *Message, caller interface{})
- func Users() *users
- type Client
- type Message
- type Room
- type User
- func (u *User) AddClt(clt *Client)
- func (u *User) AddData(k string, v string)
- func (u *User) AddRoom(room *Room)
- func (u *User) ClientCount() int
- func (u *User) DelClt(clientId string)
- func (u *User) DelRoom(roomId string)
- func (u *User) GetData(key string) string
- func (u *User) IsDead() bool
- func (u *User) Rooms() map[string]*Room
Constants ¶
View Source
const ( MsgJoin = `join` MsgLeave = `leave` MsgBroadcast = `broadcast` )
Variables ¶
View Source
var GCPeriod int = 5
how many seconds to run gc
View Source
var LifeCycle int64 = 30
for client life cycle, default 30s
Functions ¶
func NewClients ¶
func NewClients() *clients
func SendMessage ¶
func SendMessage(msg *Message, caller interface{})
Types ¶
type Client ¶
func (*Client) ReadMessages ¶
type User ¶
type User struct { Id string // contains filtered or unexported fields }
func (*User) ClientCount ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.