public virtual void Send(IEnumerable <ConnectionId> connectionIds, HubClientInvoker msg) { // Get a list from connectionIds, because it will be enumerated several times, and because it will also help thread safety var listOfConnectionIds = connectionIds.ToList(); if (!listOfConnectionIds.Any()) { return; } // Log selected events as a bundle, rather than waiting for them to be split between individual connections and clog the log files with redundant messages // The selected events are those that tends to affects a lot of users if ( // Too Much Data in log files: msg.MethodName == "AddUser" || msg.MethodName == "RemoveUser" || msg.MethodName == "AddUserTo" || msg.MethodName == "RemoveUserFrom" || msg.MethodName == "AddMessage" || msg.MethodName == "SetUserIdle") { Log.SignalROut(listOfConnectionIds, msg); } // Note: This may have been adressed by extracting a ToList() from the Enumerable foreach (var connectionId in listOfConnectionIds) { AckableQueue <HubClientInvoker> managedQueue; if (!MessageQueues.TryGetValue(connectionId, out managedQueue)) { managedQueue = CreateQueue(connectionId); } managedQueue.Enqueue(msg); } }
public virtual void Send(ConnectionId connectionId, HubClientInvoker msg) => Send(new List <ConnectionId> { connectionId }, msg);