I am looking for some inputs and advise, I think i know what i want, but i would like to reconfirm before going ahead.
I stumbled across MarketWatch.com and i see some articles on that web site with some stocks listed in different regions of the page and they are ticking up or down with live information as each second passes by.
Now I think there are few ways to achieve that ( I might be wrong with my assumption, but i am looking for to be corrected.)
The easiest way would be to call Jquery Ajax:Post function and then with result using jquery selector tag update all the stock ticks on the page, and assuming that i would like to seperate out the logic and traverse dom and update the stock quotes in respective regions.
Now this Jquery function have to do a post every 2 seconds or say 5 seconds till the page is closed by the user,
Frankly i am not liking the fact that every 2 seconds i am pinging the server or service that contains the updates of stocks and manipulating Dom again (I dont think i could get away with this manipulation in my other work around as well).
I think another workaround by avoiding Jquery and then writing Server Side listener that does reverse callbacks to client browser using AynchPattern could be a way to implement it.
But i am not sure how to do this. I know in old COM/DCOM says there were concepts of Stubs/proxy callback mechanism and then i think same also exist in .Net,
But i want to know and learn more about how to bypass(from Browser –> to Server approach) and adopt (Server —> to browser approach)
Please not that I am using .Net , C# on a windows platform. I know that Node.js could do that on Linux.
Any help and links to small examples would be appreciated.
Thanks
Sweety
Take a look at the socket.io client implementation and how it does long polling. This may be the solution you’re looking for. Note that this may cause the little loading spinner to always be active for your users, not sure if this is true though.
/fyi #node.js IRC welcomes you: http://bit.ly/nodeIRC