I understand you will find Comet server technologies which do this but I wish to write something easy and home-grown.
Whenever a record is placed right into a MySQL table, I would like it to in some way communicate this data to a number of lengthy-questioned Apache connections using PHP (or whatever). So multiple individuals are "listening" through their browser and also the second the MySQL Place happens, it's delivered to their browser and performed.
The easiest way is to achieve the PHP script poll the MySQL database, but this is not really pushing in the server and introduces some unacceptable order of unnecessary database queries. I wish to have that data from MySQL towards the lengthy-polling connection basically with no audience querying whatsoever.
Any ideas regarding how to implement this?
I've been trying a myriad of suggestions for a strategy to this too and the only method to remove the polling of sql queries would be to poll personal files rather. When the fill equals then continue looping. If file equals 1 have loop run sql queries and send to customers. It will add another degree of complexity however i would think this means less work by mysql but same for apache or no matter what looping daemon. You might send the command to some daemon "comet" style but it will fork and loop on each request too from what I've come across how electrical sockets work so hopefully someone will discover a means to fix this.
This really is something I've been searching for too for several years. I haven't found any functionality in which the SQL server pushes out a note on Card inserts, Remove and UPDATES.
TRIGGERS can run SQL on these occasions, but that's useless here.
I suppose you need to make your own system. It is simple to broadcast a UDP from PHP (Example in first comment), the issue is that PHP is running around the server side and also the customers are static.
My prediction is you can perform a Java Applet running around the client, listening for that UDP message after which trigger an update from the page.
It was only a few ideas within the moment of writing...
MySQL most likely is not the best tool with this problem. Regilero recommended varying your DB, but an simpler solution may be to make use of something similar to redis with a pub/sub feature.
I understand it is a MySQL question but, just just in case, of you have the Inform/LISTEN instructions on PostgreSQL to obtain audience registered on Database occasions. If you can replace your free database by a different one...