I’m currently building a website (ASP.net c#) and we’re looking at creating a live feed (similar to the facebook one) for data events on our website. I wanted to know your thoughts on how best to implement this as I am not sure my understanding is correct.
We have events such as: new article published, user coming online.
Users will log in to their members area and should then see the live feed.
My current thinking is that I’d have a query every few seconds (from the users browser) which looks for any new events since the last request date. If there are new ones since dateX (last request date) then show that.
I’d save the last request date along with the userID so when they come back, I know what the last thing they’ve seen is.
Is this the best way of doing it – or should I be looking at some sort of push methods? I need it to be cross browser friendly and supporting older browsers… so the HTML 5 methods I’ve looked at aren’t really an option.
Thanks for any advice.
You may want to to look into SignlarR. This is .NET library to build interactive web applications like what your scenario is.
Another options is what you mentioned in your question. Make an ajax call every n seconds to check the database and update the UI. But I think SignalR is much better than that as it don’t rely on the continuous hit approach !