从服务器通知客户端 [英] notify client from server

查看:39
本文介绍了从服务器通知客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个 asp.net 应用程序,我想在服务器发生变化时通知用户,我该怎么做.Silverlight 客户端也是如此.对于 Silverlight 客户端,是否有某种形式从 Silverlight 客户端订阅服务器上的事件?

If I have an asp.net application, and I want to notify the user when something changes on the server, how do I do this. The same thing with a silverlight client. For the silverlight client is there some form of subscribing to an event on the server from the silverlight client?

推荐答案

有两种方式.第一个是每隔几分钟检查你的服务器,但我相信你不是在搜索这种明显的方式,而是在搜索另一种称为彗星的技术.

There are 2 ways. The first one is to check your server every few minutes, but I believe that you do not search for this obvious way, you search for another technique that called comet.

彗星技术创建并打开与您的连接来自客户端的服务器,当服务器关闭连接时,表示有新消息发送给您的客户端,您的客户端读取消息,并打开一个新连接等待下一条消息.另一种方法是只打开一个连接并流式传输数据,当它们从服务器到客户端可用时,根本不关闭连接.您唯一需要注意的是增加允许访问您的站点的打开连接数.

Comet technique creates and opens connection to your server from the client, and when the server closes the connection, it means that there is a new message for your client, your client reads the messages, and opens a new connection waiting for the next message. The other way is to just open a connection and stream the data, when they are available from the server to the client, and not to close the connection at all. The only thing that you need to take care of is to increase the number of open connections that allowed to your site.

使用 asp.net 检查此站点是否有彗星

Check this sites for comet with asp.net

http://www.frozenmountain.com/websync/

http://www.aaronlerch.com/blog/2007/07/08/creating-comet-applications-with-aspnet/

这篇关于从服务器通知客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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