将警报推送到浏览器 [英] Push Alert to Browser

查看:70
本文介绍了将警报推送到浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找将信息从服务器推送到客户端的架构

浏览器。这些信息将以警报的形式出现。我不想做的是b $ b想要做的是让浏览器在计时器上并且每隔几秒更新一次。

我需要有哪些选项来实现这样的功能?

I am looking for architecture to push information from a server to a client
browser. This information would be in the form of an alert. What I do not
want to do is have the browser be on a timer and update every few seconds.
What options do I have to put into place such a feature?

推荐答案

你最好的,也许是最简单的赌注是避免使用推送技术

完全是因为它

开箱即用,并没有太长时间的痛苦和死亡。我能想到的最简单的事情就是为页面设置一个

元标记来自动刷新页面。这很好

因为它不涉及任何编程。缺点是它刷新了整个页面的b $ b。然后,您可以创建一个内联框架,该框架将显示页面小得多的区域,并且在此区域中有一个名为

的网页,每隔一段时间刷新一次。这应该有用,虽然我之前没有在iframe中玩过这样的

嵌入式刷新。


设置刷新频率时保持性能心里。如果您有不同用户打开的浏览器窗口数量,那么您将开始获得

大量不断点击检查警报状态。这可能会降低

的性能,但你应该能够通过做一些非常小的编程来最小化它。


希望这有帮助,

Mark Fitzpatrick

Microsoft MVP - FrontPage


" Nick K." < NI ** @ bogus.com>在留言中写道

新闻:ei ************** @ TK2MSFTNGP14.phx.gbl ...
Your best, and probably easiest bet, is to avoid using push technology
entirely since it''s too much of a pain to work with and died not long after
coming out of the box. The simplest thing I can think of is to just set a
meta tag for the page to refresh the page automatically. This is nice
because it doesn''t involve any programming. The downside is it does refresh
the entire page. You could then create an inline frame that would present a
much smaller area of the page, and in this area have a web page called that
refreshes every so often. This should work, though I haven''t toyed with an
embedded refresh like this in an iframe before.

When setting how often to refresh keep performance in mind. If you have a
number of browser windows open from different users then you''ll start to get
a lot of constant hits checking for an alert status. This could drop the
performance down but you should be able to minimize it by doing some very
careful programming.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Nick K." <ni**@bogus.com> wrote in message
news:ei**************@TK2MSFTNGP14.phx.gbl...
我正在寻找建筑将信息从服务器推送到客户端浏览器。这些信息将以警报的形式出现。我不想做的是将浏览器放在计时器上并每隔几秒更新一次。
我需要有哪些选项才能实现这样的功能?
I am looking for architecture to push information from a server to a client
browser. This information would be in the form of an alert. What I do not
want to do is have the browser be on a timer and update every few seconds.
What options do I have to put into place such a feature?



我已经在一个

抵押贷款公司的企业应用程序中实现了这个架构。我们使用了消息传递。范例,在

客户端上调用的网页中的隐藏IFRAME中加载了.NET

程序集。成功登录后,此程序集使用

服务器端Windows服务注册,将客户端IP放在哈希表中。

每两分钟,服务器ping一次。内存中的客户端IP有两个字节的挑战,以确保它们仍处于活动状态(即客户端

没有关闭浏览器或导航到另一个站点) 。如果服务器

没有收到响应,它会从哈希表中删除该IP。


当需要将消息推送到客户端时,服务器从我们的服务器端应用程序收到了一个

..NET远程调用,将消息推送到特定用户的
。消息传递服务器在其

哈希表中快速查找已注册的客户端IP,该客户端IP与通过远程调用传入的唯一登录密钥

相匹配。如果它找到了登录

密钥,消息服务器会通过

TCP / IP端口80将消息推送到客户端,客户端程序集会将消息传递给

浏览器并使用新的

消息动态更新页面上的HTML表格。在你的情况下,你可以让IE弹出一个消息框,或者你可以创建一个自定义的Windows.NET表单来直接从嵌入式.NET程序集中显示消息。


这个已经生产了一年多没有任何问题和工作

可靠。


希望这个帮助。


Nick K.写道:
I have implemented this architecture in an enterprise application for a
mortgage company. We used a "Messaging" paradigm where there was a .NET
assembly loaded in a hidden IFRAME in a webpage that was invoked on the
client. On successful login, this assembly registered with a
server-side Windows Service that placed the client IP in a hashtable.
Every two minutes, the server "pinged" the client IPs in memory with a
two byte challenge to ensure they were still alive (i.e., the client
didn''t close the browser or navigate to another site). If the server
did not receive a response, it removed that IP from its hashtable.

When a message needed to be pushed to the client, the server received a
..NET remoting call from our server-side app to push the message to a
particular user. The messaging server did a quick lookup in its
hashtable for a registered client IP that matched the unique login key
that was passed in through the remoting call. If it found the login
key, the messaging server would push the message to the client over
TCP/IP port 80 and the client assembly would pass the message to the
browser and dynamically update an HTML table on the page with the new
message. In your case, you could have IE pop up a messagebox or you
could create a custom Windows.NET form to show the message directly from
the embedded .NET assembly.

This has been in production for over a year with no problems and works
reliably.

Hope this helps.

Nick K. wrote:
我正在寻找将信息从服务器推送到客户端浏览器的架构。这些信息将以警报的形式出现。我不想做的是将浏览器放在计时器上并每隔几秒更新一次。
我需要有哪些选项才能实现这样的功能?
I am looking for architecture to push information from a server to a client
browser. This information would be in the form of an alert. What I do not
want to do is have the browser be on a timer and update every few seconds.
What options do I have to put into place such a feature?



你无法推送到浏览器。

浏览器不支持此功能。

唯一可以的方式要做的是在你的

页面中嵌入一个较低级别的组件,例如ActiveX控件。然后你必须手动编写所有的

网络代码。


让浏览器在

定时间隔,即使它不理想。


-

我希望这会有所帮助,

Steve C. Orr,MCSD,MVP
http://Steve.Orr.net


" Nick K." < NI ** @ bogus.com>在留言中写道

新闻:ei ************** @ TK2MSFTNGP14.phx.gbl ...
You cannot push to a browser.
Browsers do not support this capability.
The only way it could be done is to embed a lower level component in your
page, such as an ActiveX control. Then you''d have to write all the
networking code manually.

It is far more feasible to have the browser initiate communication on a
timed interval even if it''s not ideal.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Nick K." <ni**@bogus.com> wrote in message
news:ei**************@TK2MSFTNGP14.phx.gbl...
我正在寻找建筑将信息从服务器推送到客户端浏览器。这些信息将以警报的形式出现。我不想做的是将浏览器放在计时器上并每隔几秒更新一次。
我需要有哪些选项才能实现这样的功能?
I am looking for architecture to push information from a server to a client
browser. This information would be in the form of an alert. What I do not
want to do is have the browser be on a timer and update every few seconds.
What options do I have to put into place such a feature?



这篇关于将警报推送到浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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