如何显示实时信息给用户? [英] How do I display real-time information to the user?

查看:96
本文介绍了如何显示实时信息给用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要表现出新的评论在实时用户(类似YouTube的现场评论系统,但没有自动添加)。

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

也许我需要用池与ASYN控制器来处理请求,然后表现出来,如果​​用户点击了类似表现出更多的10条评论。

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".

或者,例如,类似于#1的警报新收件箱消息

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

推荐答案

它看起来像你想推数据的实时用户。

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

previously这可能已经完成了位被称为一个黑客的解决方案长轮询

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.

然而,你可能要考虑HTML5的世界的WebSockets 的。要做到这一点,我建议你读了 SignalR 并遵循一些教程(看pluralsight视频)。

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是ASP.NET开发一个新的图书馆,它简化了添加实时网络功能,你的应用程序的过程。

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.

这篇关于如何显示实时信息给用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆