按通知到客户端浏览器 [英] Push notification to the client browser

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

问题描述

我想创造一个当一个超级用户点击一个链接的用户应该得到一个通知,或者说像一个PDF格式让他们在屏幕上访问内容的应用程序。

I'd like to create an application where when a Super user clicks a link the users should get a notification or rather a content like a pdf for them to access on the screen.

用例:当老师想与大家分享他的学生一个PDF,他应该能够告知他的学生对PDF格式提供下载和链接,必须提供做同样的

Use Case: When a teacher wants to share a PDF with his students he should be able to notify his students about the pdf available for download and a link has to be provided to do the same.

推荐答案

当你想在CakePHP中实现这个(所以我认为这是一个基于Web的应用程序),用户将必须有一个活跃页面中打开为了接收推送消息。

As you want to implement this in CakePHP (so I assume it's a web-based application), the user will have to have an 'active' page open in order to receive the push messages.

这是值得看的前两个答案,这一点,但也只是想想其他网站会如何实现这一目标。 Facebook这样的网站,英国广播公司,所有的#1使用技术来保证页面是最新的。

It's worth looking at the first two answers to this, but also just think about how other sites might achieve this. Sites like Facebook, BBC, Stackoverflow all use techniques to keep pages up to date.

我怀疑Facebook的只是使用了一些AJAX运行在一个循环/定时器定期提取更新的方式,将使它看起来像推。如果更新请求是往往不够(短的时间内),它会几乎看实时的。如果这是一个很长的时间,它会看起来像一个拉。查找与先进的,最新性和浏览器/处理器/网络抖动是关键的平衡。

I suspect Facebook just uses some AJAX that runs in a loop/timer to periodically pull updates in a way that would make it look like push. If the update request is often enough (short time period), it'll almost look realtime. If it's a long time period it'll look like a pull. Finding the right balance between up-to-dateness and browser/processor/network thrashing is the key.

实际的请求不应捶打系统,但在一些应用中,应答可以是大得多。在你的情况,在各个方向的数据是微小的,所以你可以提出请求循环很短。

The actual request shouldn't thrash the system, but the reply in some applications may be much bigger. In your case, the data in each direction is tiny, so you could make the request loop quite short.

实验!

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

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