Timur  Shahbanov
Timur Shahbanov

Reputation: 425

How do I display real-time information to the user?

I need to show new comments to the user in real-time (similar to Youtube's live comments system but with no auto-adding).

Maybe I need to use pools with Asyn controller to handle requests and then show it if the user clicks on something like "show more 10 comments".

Or, for example, similar to Stackoverflow's alert for new inbox messages.

Upvotes: 1

Views: 176

Answers (1)

Rowan Freeman
Rowan Freeman

Reputation: 16388

It looks like you're wanting to 'push' data to the user in real-time.

Previously this might have been done with a bit of a 'hack' solution known as long-polling

With long polling, the client requests information from the server in a way similar to a normal polling; however, if the server does not have any information available for the client, then instead of sending an empty response, the server holds the request and waits for information to become available (or for a suitable timeout event), after which a complete response is finally sent to the client.

However you might want to look into the HTML5 world of WebSockets. To do this I'd recommend reading up on SignalR and following some tutorials (watch the pluralsight videos).

ASP.NET SignalR is a new library for ASP.NET developers that simplifies the process of adding real-time web functionality to your applications.

There is a lot of information already available on this topic.

Upvotes: 3

Related Questions