public static async Task Notify(int eventId)
        {
            if (Clients != null)
            {
                try
                {
                    var clients = redisDB.GetAll();


                    var userConnections = clients.Where(c => c.EventId == eventId).Select(c => c.Connections.Select(i => i.Id)).ToList();

                    foreach (var connections in userConnections)
                    {
                        foreach (var connectionId in connections)
                        {
                            await Clients.Client(connectionId).SendAsync("ReceiveMessage", "Server", "notify");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Exemple #2
0
        static void Test()
        {
            RedisDB <Models.ClientConnection> redisDB = new RedisDB <Models.ClientConnection>();

            var items = redisDB.GetAll();
        }