Пример #1
0
// Room construct
func NewRoom(roomID int64) (r *Room) {
	r = new(Room)
	r.messages = make(chan *Message)
	r.users = gs.NewSMap() // global shared map
	r.roomID = roomID
	go r.RoomMessageLoop() // for broadcast message
	return
}
Пример #2
0
func InitRooms() {
	rooms = gs.NewSMap()
	rand.Seed(time.Now().UTC().UnixNano())
}