最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Long polling for real time messagesupdates - Stack Overflow

programmeradmin5浏览0评论

What is a good strategy for implementing long polling in a .Net application.

Would it mean having a JS setInterval() based approach to keep polling the server for updates that can be rendered on the page. I have always thought that that could be a challenge when it es to scalability as it seems it would generate a lot of extra requests to the web server. I have read that this type of functionality should be implemented using a non blocking web server (single threaded) NODE.js etc... Since there's only one thread/event loop it seems like the requests would have to be very lightweight to service several requests in a timely fashion. Can Node.Js trigger db calls?

I have seen an online dating site where you receive notification in the form of a fad-in/fade-out popup when someone visits your profile when you're currently logged into the system. I am impressed that something like that can work so well for a high volume site.

Is it reasonable to assume that this type of notification system is implemented using long polling? Based on constantly polling through JS?

I am seeing similar behind the scenes updates her on the SO site as well (messages/votes etc) Does this use a similar strategy as well?

What is a good strategy for implementing long polling in a .Net application.

Would it mean having a JS setInterval() based approach to keep polling the server for updates that can be rendered on the page. I have always thought that that could be a challenge when it es to scalability as it seems it would generate a lot of extra requests to the web server. I have read that this type of functionality should be implemented using a non blocking web server (single threaded) NODE.js etc... Since there's only one thread/event loop it seems like the requests would have to be very lightweight to service several requests in a timely fashion. Can Node.Js trigger db calls?

I have seen an online dating site where you receive notification in the form of a fad-in/fade-out popup when someone visits your profile when you're currently logged into the system. I am impressed that something like that can work so well for a high volume site.

Is it reasonable to assume that this type of notification system is implemented using long polling? Based on constantly polling through JS?

I am seeing similar behind the scenes updates her on the SO site as well (messages/votes etc) Does this use a similar strategy as well?

Share Improve this question edited Mar 31, 2012 at 6:43 TGH asked Mar 31, 2012 at 6:05 TGHTGH 39.3k12 gold badges105 silver badges140 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

SignalR and pokein are two good options.

A blog post by scott hanselman which explains using SignalR http://www.hanselman./blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx

Realtime web applications have been with us for quite some time now: the history of Polling goes from setInterval Technique to HTML5 WebSockets.

Here you can find Simple Long Polling Example with JavaScript.

http://techoctave./c7/posts/60-simple-long-polling-example-with-javascript-and-jquery

发布评论

评论列表(0)

  1. 暂无评论