-2

Possible Duplicate:
C#/ASP Based Reverse AJAX

Requirement : We have to push message to Client when new notification arrives. Almost it is like a message notification OR broadcast. It may be for more than one user.

Need it in ASP.NET web application.

Any solutions ?

Community
  • 1
  • 1

3 Answers3

4

The most technically appropriate solution for this is simply: web-sockets. They are designed exactly for this, and it is how most major sites with a real-time requirement prefer to work. It is indeed how the real-time updates here on stackoverflow work. The minor glitch here is that some browsers (ok, IE) don't support them - so if the update is important you need a fallback.

The next st of options are things like long-polling and repeat-polling. Both work.

There are tools around that support all the viable options and select the most appropriate automatically, abstracting over the delivery mechanism. SignalR is such a tool.

If this is a nice-to-have, I'd say web-sockets. If it is a requirement, either web-sockets-plus-polling-fallback, or something like SignalR.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
1

What about SignalR. You could check this video from Scott Hanselman about SignalR. Alos there are plenty of samples on the internet.

czlatea
  • 1,131
  • 13
  • 20
  • Hi Florin, welcome to Stack Overflow! While the link may be helpful, in general, answers should fully answer the question and be self-contained. If this link were to ever break, your answer would be useless to future visitors. Consider making an [edit] to your post to add an example. That would be something that would help not only the asker, but others seeking an answer later on. Good luck! – jamesmortensen Oct 27 '12 at 09:14
0

One way is to use Ajax to accomplish this functionality.... Use Classic Ajax to get the response if new notification arrives...Call SetTimeOut to constantly call this ajax function after each time interval...If any new notification is arrived you will get it in your ajax response....if it is there you can use this response to show it to the clients in any way you want...you can get to know more about Ajax at http://www.w3schools.com/ajax/ajax_xmlhttprequest_send.asp

Amol Kolekar
  • 2,307
  • 5
  • 30
  • 45
  • Nice solution.It is continuous polling mechanism.In this case server becomes busy at one point of time.If it is on demand then it is ok.Any comments ? – Sridhar Reddy Bommireddy Oct 27 '12 at 09:10
  • yes you are right that concern is there....but it also depends on the how much response you are getting through ajax as weel as no of users...also one way is to prolonged the timeout interval... – Amol Kolekar Oct 27 '12 at 09:27