Esempio n. 1
0
 internal IEnumerable<Guid> FindInterestedSubscribers(TypeOfInterest toi)
 {
     lock (_connections)
     {
         return _connections
             .Where(kvp => kvp.Value.Tois.Contains(toi))
             .Select(kvp => kvp.Value.Id).Distinct();
     }
 }
Esempio n. 2
0
        // 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());
        }
Esempio n. 3
0
 private static void OnUpdated(TypeOfInterest toi)
 {
     Console.WriteLine($"Changed objects: " + toi.ToString());
 }
Esempio n. 4
0
 public void OnUpdated(TypeOfInterest toi)
 {
     Clients.All.Updated(toi);
 }
Esempio n. 5
0
 public static IEnumerable <Guid> FindInterestedSubscribers(TypeOfInterest toi)
 {
     return(_connectionFilters.FindInterestedSubscribers(toi));
 }