I have a webservice which connects to a Redis Subscription as follows:
using (RedisClient rc = new RedisClient("Publisher IP", 6379))
{
using (RedisSubscription rs = new RedisSubscription(rc))
{
rs.OnMessage = (channel, msg) =>
{
//msg is an object in json format to be displayed in html table
};
rs.SubscribeToChannels("Channel Name");
}
}
Things I have tried so far:
rs.OnMessage
code block. msg
value in Session
and then call that value in the web page. The Session value does not seem to update however.I am willing to try other techniques as well. Since I have just started with this project, I can start from scratch as well. Any suggestions on how I can do this?
For anyone, who might stumble onto this. I finally managed to do it by storing the most recent value from the subscription in a Redis key value pair (Hset), and then ran an AJAX call to retrieve that value in a loop. A list can also be used if you want some kind of cache or if you want to perform some operations received from the publisher. However, managing the list so as to not create a lot of overhead is a tricky task.