internal IEnumerable<Guid> FindInterestedSubscribers(TypeOfInterest toi) { lock (_connections) { return _connections .Where(kvp => kvp.Value.Tois.Contains(toi)) .Select(kvp => kvp.Value.Id).Distinct(); } }
// GET api/values public async Task <IHttpActionResult> Fire([FromUri] TypeOfInterest toi) { var subscribers = UpdatesHub.FindInterestedSubscribers(toi); if (subscribers.Any()) { var hub = _connectionManager.GetHubContext <UpdatesHub>(); foreach (Guid id in subscribers) { IClientProxy proxy = hub.Clients.Group(id.ToString()); await proxy.Invoke(nameof(IClient.Updated), toi); } } //await hub.Clients.All.OnUpdated(toi); return(Ok()); }
private static void OnUpdated(TypeOfInterest toi) { Console.WriteLine($"Changed objects: " + toi.ToString()); }
public void OnUpdated(TypeOfInterest toi) { Clients.All.Updated(toi); }
public static IEnumerable <Guid> FindInterestedSubscribers(TypeOfInterest toi) { return(_connectionFilters.FindInterestedSubscribers(toi)); }