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

Source: Internet
Author: User
My requirement is that workerman is used for the long link between the front and back ends. Once a mysql table has new data, it sends the new data to the front end, the sent data is an array. How can I implement it? If my description is not clear enough, please ask again and wait online. Thank you... my requirement is that workerman is used for the long link between the front and back ends. Once a mysql table has new data, it sends the new data to the front end, the sent data is an array. How can I implement it? If my description is not clear enough, ask again and wait online. Thank you for your help.

Reply content:

My requirement is that workerman is used for the long link between the front and back ends. Once a mysql table has new data, it sends the new data to the front end, the sent data is an array. How can I implement it? If my description is not clear enough, ask again and wait online. Thank you for your help.

Http://www.workerman.net/web-sender
It can be pushed through phpsocket. io of workerman.

Http://wenda.workerman.net /? /Question/508
You can open a text port push in Worker.

Http://workerman.net/gatewaydoc/advanced/push.html
Use workerman's gatewayWorker push and GatewayClient

You need to control when to trigger and how to trigger it.

I usually use redis to solve the problem.

Check whether data needs to be sent to the front-end when the table is inserted.

Use a trigger. First, create a custom function. The function will access the port of the program you want to call back, and then call the function in the trigger-I am talking about the mysql trigger, mysql diy functions can be directly written in c, which is convenient and fast. php installs a multi-threaded module and listens to two ports. One is used to interact with the front-end websocket, A socketid table can be created in the database to receive the data sent by the mysql trigger, which is used to associate various threads. net will be easier to write

You can check the database regularly. If there is data, call the workerman interface and send it to the database.

When I met this requirement, I needed the database to actively push data to the application, but I didn't find any solution. I want to ask if dba has such a method. I used a scheduled task in the solution, training database ~

In addition, can I give you a system notification during the data entry process? For details, refer to the design.

I have never been familiar with workerman, and I write less code. I just provide one idea:

Add an interception function to the Data Writing code to notify workerman.

This has a limitation, that is, if the database has multiple write entries, it will be very painful.

Try not to work with mysql

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.