PHP MYSQL event listener

送分小仙女□ 提交于 2019-12-25 09:19:18

问题


I need to build a solution for my supervision page.

I have a system for many users and an office manager, and i created a supervision page in order to supervise the login and status of each user.

When the user log-in to the system, ta row in the DB will be updated. same for his status in the system (Busy, Available, offline...).

What i did that i created an iframe in which am checking those data from DB and refreshing the iframe each 5 seconds in order to check any update.

Is there any solution like listener that allow me to get real time data from DB ? Or when the row in the DB changed, so i get this update in my system ?

Thank you all


回答1:


You can do via many methods, some of which are:

  1. take a div instead of your iframe and send AJAX request every 5 seconds and fetch data from database and over write the innerHtml of this div.
  2. cache the data and make it dependent on the database operations like insertion, updation or status change. and show the data in the div from the cache
  3. the best and simplest way is to use pusher.....it works for push notifications and u can notify do anything once the client is notified

I would recommend using pusher.



来源:https://stackoverflow.com/questions/40387915/php-mysql-event-listener

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!