简体   繁体   English

ASP.net中的服务器回调

[英]Server callbacks in ASP.net

What is the correct way to implement server callbacks in ASP.net to update a control? 在ASP.net中实现服务器回调以更新控件的正确方法是什么? I know all about AJAX and async client calls to server but what about this scenario: 我了解有关服务器的AJAX和异步客户端调用的全部知识,但这种情况如何:

You display a treeview (server control) with a list of items to the user. 您将显示一个树视图(服务器控件),其中包含用户列表。 You have a server process running which checks a queue. 您有一个正在运行的服务器进程正在检查队列。 When an item gets added to the queue it should update the tree control. 将项目添加到队列时,它应该更新树控件。 How? 怎么样? Sounds easy. 听起来很简单。 But seems ridiculously difficult in ASP.net. 但是在ASP.net中似乎非常困难。

The server cannot (generally) push content out to the client. 服务器无法(通常)将内容推送到客户端。 Web browsers operate in a disconnected environment - in order to simulate "push" behavior you have to have the client periodically poll the server. Web浏览器在断开连接的环境中运行-为了模拟“推送”行为,您必须让客户端定期轮询服务器。

The exception to this is if you can use a technology like Silverlight or Flash, which can maintain persistent duplex connections to the server independent of the browser. 例外情况是,如果您可以使用Silverlight或Flash之类的技术,该技术可以独立于浏览器维护与服务器的持久双工连接。

As far as I'm aware, most website that appear to dynamically "push" content out to the browser (eg. gmail, facebook chat, etc) are really polling periodically from the client. 据我所知,大多数似乎动态地将内容“推送”到浏览器(例如gmail,facebook聊天等)的网站实际上都是定期从客户端进行轮询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM