简体   繁体   中英

Real Time Functionlity with php

I am working on attendance system where project management system is also handling using Javascript\\Jquery at client side and PHP\\MySQL at server side.

A feature in my web app is user message to admin. For this I have applied an ajax request which is made by setTimeout function (after every 15 seconds) to check that is there any new message comes in database if yes then return it to the admin.

It working fine but the drawback is (as you know) continuous request to server which really poor and bad. As I know that real time functionality can solve this problem I have checked some link websocket.io and signlR but there are applicable with Nodejs and asp.net. So, how can I apply real time functionality with php or I get that new data have reached in to database without continues request with ajax.

There are actually some PHP tools for doing this now. For instance, check out Ratchet .

It's also possible to do bi-directional sockets by creating a simple TCP/IP server. I've done this before for bi-directional communication between a PHP server and a desktop app.

http://php.net/manual/en/sockets.examples.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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