예제 #1
0
        static void Main(string[] args)
        {
            var conf = new RedisEndpoint()
            {
                Host = "xxxxxxxxxxxxxx.redis.cache.windows.net", Password = "******", Ssl = true, Port = 6380
            };

            using (IRedisClient client = new RedisClient(conf))
            {
                IRedisSubscription sub = null;
                using (sub = client.CreateSubscription())
                {
                    sub.OnMessage += (channel, message) =>
                    {
                        try
                        {
                            List <Item> items = JsonConvert.DeserializeObject <List <Item> >(message);
                            Console.WriteLine((string)message);
                            SignalRClass sc = new SignalRClass();
                            sc.SendRank(items);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                    };
                }
                sub.SubscribeToChannels(new string[] { "Rank" });
            }

            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            var conf = new RedisEndpoint() { Host = "xxxxxxxxxxxxxx.redis.cache.windows.net", Password = "******", Ssl = true, Port = 6380 };
            using (IRedisClient client = new RedisClient(conf))
            {
                IRedisSubscription sub = null;
                using (sub = client.CreateSubscription())
                {
                    sub.OnMessage += (channel, message) =>
                    {
                        try
                        {
                            List<Item> items = JsonConvert.DeserializeObject<List<Item>>(message);
                            Console.WriteLine((string)message);
                            SignalRClass sc = new SignalRClass();
                            sc.SendRank(items);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                    };
                }
                sub.SubscribeToChannels(new string[] { "Rank" });
            }

            Console.ReadLine();
        }