Workerman How to implement a table in MySQL database once the new data is added, the new data is sent to the front end?

Source: Internet
Author: User
My requirement is this, use Workerman to do long link on the front and back, then a table of MySQL once have new data, send the new data to the front end, send the data is the array, how should I implement? If my description is not clear enough, please ask again, I am online and so on, thank God help solve.

Reply content:

My requirement is this, use Workerman to do long link on the front and back, then a table of MySQL once have new data, send the new data to the front end, send the data is the array, how should I implement? If my description is not clear enough, please ask again, I am online and so on, thank God help solve.

Http://www.workerman.net/web-sender
Can be pushed through Workerman's Phpsocket.io

http://wenda.workerman.net/?/question/508
You can open a text port in the worker push

Http://workerman.net/gatewaydoc/advanced/push.html
Using Workerman's gatewayworker push, use gatewayclient

When and how triggers need to be controlled by themselves

I usually use Redis to solve.

Decide if you want to send the data to the front end where the table is inserted

Use the trigger bar, first create a custom function, the function will access the port of the program you need to callback, and then invoke the function inside the trigger----I said is the MySQL trigger, MySQL DIY function can be directly written in C, convenient and fast, PHP installed a multi-threaded module, listening to two ports, One for interacting with the front-end WebSocket, one for receiving data sent by the MySQL trigger, you can create a Socketid table in the database to associate each thread, in fact, this kind of broken things with. NET will be better written

Can periodically check the database, if there is data, the tune Workerman interface sent past

I met this demand, need the database to actively push the data to the application notification, but did not find what solution, this to ask the DBA is not this means, my solution at the time with the scheduled task, rotation database ~

In addition, the data input process there can give you system a notice what, specifically can talk about design

No contact with Workerman, the code is also written less, just provide a way of thinking:

在写入数据 的代码那里加一个 拦截函数,起到通知workerman的作用

This has a limitation, that is, the database has a number of write entry, so it hurts.

Try not to combine with MySQL

  • Related Article

    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.