服务器可以向客户端发送通知吗? [英] Can server send notification to client?

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

问题描述

大家好!

我正在做一个关于Webmail的项目.我希望服务器在新邮件收入时向客户端发送通知,而不是每分钟向服务器发送客户端请求.

服务器是否可以向客户端发送通知?
如果可能的话,请给我一些建议.

我将PHP用作服务器端,并将jQuery用作客户端.

谢谢

hi every one!

i am doing a project regards to Webmail. I want server to send notification to client when new mail incomes rather than client request to server every minute.

Is it possible that Server could send notification to client?
If possible, please give me some advise.

I am using PHP as server-side and jQuery as client-side.

Thanks

推荐答案

这称为推送技术".以下是概述: http://en.wikipedia.org/wiki/Push_technology [
—SA
This is called Push Technology. Here is the overview: http://en.wikipedia.org/wiki/Push_technology[^].

You can go to "See also" section and get information on available protocols and implementations.

—SA


通常,不可能.将响应提供给客户端后,服务器不知道它是否仍然存在.可能关闭了连接,用户导航到了另一个站点或页面,或者用户可能去吃了午饭.唯一的方法是维持服务器和客户端之间的开放连接.对于Web应用程序,这是不可能甚至不是个好主意.
In general no it is not possible. After the response is served to the client the server has no idea whether it still exists. The connection could be closed, the user navigated to another site or page, or the user could have gone to lunch. The only way would be to maintain an open connection between the server and client. Not possible or even a good idea for a web application.


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

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