简体   繁体   English

用jquery和php实时通知

[英]real time notifications with jquery and php

I'm trying to find some php and jquery tutorial/plugin or piece of code which enables to get the real time notifications. 我正在尝试找到一些php和jquery教程/插件或一段代码,它们可以获得实时通知。 For example, if some data is inserted in the database, i want to receive the notification on the webpage in real time without refresh etc. If you know any resource, please let me know. 例如,如果在数据库中插入了一些数据,我想在网页上实时接收通知而不刷新等。如果您知道任何资源,请告诉我。 Bundle of thanks. 一揽子的谢谢。

You will need to poll the server, preferably using long polling (not trivial with PHP). 您需要轮询服务器,最好使用长轮询 (使用PHP不是很简单)。

The server can respond blank, or a JSON message if there is something to be returned. 如果有要返回的内容,服务器可以响应空白或JSON消息。

here is periodic updater built as a jQuery plugin that tries to implement long polling and reduce the load on the server. 这里是定期更新程序,构建为jQuery插件,尝试实现长轮询并减少服务器上的负载。

https://github.com/RobertFischer/JQuery-PeriodicalUpdater/ https://github.com/RobertFischer/JQuery-PeriodicalUpdater/

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

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