Example #1
0
//Broadcast the message to the clients with id contained in the list
func (hub *Hub) Multicast(ids []uint64, mex *message.Answer) {

	//convert the message once
	bytes := mex.ToByteArray()
	for _, id := range ids {

		//get client from map
		s, ok := hub.socketMap.Get(id)

		if ok == true {
			//send the data directly to client's write goroutine
			s.(*mexsocket.MexSocket).OutgoingBinary() <- bytes
		}
	}

}