问题
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:
- 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.
- 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
- 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