简体   繁体   English

php mysql后台进程

[英]php mysql background process

i have developing a website that user can chat with other user if they are online . 我已经开发了一个网站,用户可以与其他用户聊天,如果他们在线。 if one user send a message will notify that receiver on their screen , these checking process are happen in background process , i have an option of using 如果一个用户发送消息会通知其屏幕上的接收者,则这些检查过程是在后台过程中进行的,我可以选择使用

setinterval method and javascript self execution method setinterval方法和javascript自我执行方法

but i am looking much faster background process methods which will check every seconds if message or notification arrived . 但是我正在寻找更快的后台处理方法,它将每隔一秒检查一次消息或通知是否到达。

could any one give suggestion for this. 谁能对此提出建议。

You can use HTML5 websockets. 您可以使用HTML5网络套接字。

WebSockets is an advanced technology that makes it possible to open an interactive communication session between the user's browser and a server. WebSockets是一项先进的技术,可以打开用户浏览器和服务器之间的交互式通信会话。 With this API(JS functions), you can send messages to a server and receive event-driven responses without having to poll the server for a reply. 使用此API(JS函数),您可以将消息发送到服务器并接收事件驱动的响应,而不必轮询服务器以获取答复。

below is good link to start 以下是开始的好链接

http://www.sanwebe.com/2013/05/chat-using-websocket-php-socket http://www.sanwebe.com/2013/05/chat-using-websocket-php-socket

I think the best match for your needs will be http://elephant.io 我认为最适合您需求的将是http://elephant.io

Elephant.io provides a socket.io client fully written in PHP that should be usable everywhere in your project. Elephant.io提供了完全用PHP编写的socket.io客户端,该客户端应可在项目中的任何地方使用。

Take a look at the Thruway Project . 看一看Thruway项目 It's a PHP websocket implementation using the WAMP protocol, which gives you Publish and Subscribe abilities (you can use that for your chat application) as well as RPC. 这是使用WAMP协议的PHP Websocket实现,它为您提供了发布和订阅功能(您可以将其用于聊天应用程序)以及RPC。

A good place to start would to take a look at this chat demo ( source code ) and then use Thruway as the WAMP router. 一个不错的起点是看一下这个聊天演示源代码 ),然后将Thruway用作WAMP路由器。

I'm one of the developers of the thruway project, so if you run into any issues or have any questions, feel free to ask. 我是thruway项目的开发人员之一,因此,如果您遇到任何问题或有任何疑问,请随时提出。

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

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