public void BroadcastMessage <T>(T msg) { var ms = new System.IO.MemoryStream(); _msgCodec.ConstructProtoMessage(ms, msg); _server.Multicast(ms.GetBuffer(), 0, ms.Position); }
public void SendMessage <T>(T msg) { var ms = new System.IO.MemoryStream(); _msgCodec.ConstructProtoMessage(ms, msg); SendAsync(ms.GetBuffer(), 0, ms.Position); }
/// <summary> /// Sends message to all identified clients who are interested /// </summary> public void SendToAllSubscribed <T>(T msg, EMsgRecipCateg msgCategoryMask) where T : Message { var ms = new System.IO.MemoryStream(); _msgCodec.ConstructProtoMessage(ms, msg); if (!msg.IsFrequent) { log.Debug($"[master] => [*]: {msg}"); } foreach (var s in _identifiedClients.Values) { if (s.WantsReceiveMessage(msgCategoryMask)) { s.SendAsync(ms.GetBuffer(), 0, ms.Position); } } }