/// <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); } } }
public ClientIdent(string name, EMsgRecipCateg subscription) { Name = name; SubscribedTo = subscription; }
public bool WantsReceiveMessage(EMsgRecipCateg msgCategory) { return((msgCategory & Ident?.SubscribedTo) != 0); }