// 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 }
func InitRooms() { rooms = gs.NewSMap() rand.Seed(time.Now().UTC().UnixNano()) }