I have been working around a bit with event-listeners in JavaScript as of late and also started working on a small browser-based irc-module and it got me thinking. Is it possible to add an event-listener to the php-script that would update variables, arrays or even echo out the data directly from a database?
I have read PHP Event-Listener best-practice implementation among others, but haven't really understood exactly how that would help me. Perhaps I'm just slow at this point, but it would be a great boost if someone could explain to me how to set up an event-listener that would listen towards a mysql-database for changes.
I do not ask anyone to code for me, but to tell me if it works and perhaps even explain how. I do not want to have a javascript-intervall checking the php-file every 100 milisecond to keep the chat flowing, that would only slow it down in the end.
If I have explained myself badly, do say so and I shall try better. I do not have the best reputation for explanations.