How does workerman implement that once new data is added to a table in the mysql database, it will send the new data to the front end?

my requirement is that I use workerman to make long links between the front and back ends, and then once a table in mysql has new data, it will send the new data to the front end, and the data sent is an array. How should I implement it? If my description is not clear enough, please ask again. I am online and so on. Thank you for your help.

Apr.02,2021

http://www.workerman.net/web-sender
can be pushed via workerman's phpsocket.io

http://wenda.workerman.net/?/question/508
can open a text port in Worker to push

http://workerman.net/gatewaydoc/advanced/push.html
uses workerman's gatewayWorker push, using GatewayClient

when and how to trigger need to be controlled by yourself


I usually use redis to solve the problem.


determine whether you need to send the data to the front end


use the trigger. First, create a custom function. The function will access the port of the program you need to call back, and then the function is called in the trigger. What I'm saying is that the mysql trigger, mysql diy function can be written directly in c, convenient and fast. Php installs a multi-threaded module. Listen to two ports, one for interacting with the front-end websocket and the other for receiving the data sent by the mysql trigger. You can set up a socketid table in the database to associate each thread. In fact, it is easier to write


to check the database regularly. If there is any data, call the interface of workerman to send it to


.

I encountered this requirement at that time, and I needed the database to actively push data to the application program to notify, but I did not find any solution. I would like to ask dba if there is such a means. The scheduled tasks used by my solution at that time, the database of rotation training ~

in addition, in the process of data entry, can I give you a notice of the system? you can talk about design

.

try not to combine with mysql


this video of the actual combat project between workerman and thinkPHP is good. It uses websocket protocol to achieve a long connection for instant messaging and online customer service. Address http://study.163.com/course/i.


give me an idea

  1. Websocket Service
  2. Text or other custom protocol services
  3. 1 the workstart of the service starts an asynchronous client connection 2
  4. Php backend connection 2 service, socket connection push event (Synchronize)

5. The message is passed through the text service and then forwarded to the client in 1, then transferred to the 1 service, and then pushed to a specific front end

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be5d64-317cb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be5d64-317cb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?