websockets and database updates (push on change)

Viewed 14917

I started to learn websockets today, since I want to have an architecture, with which I can get real-time updates.

I created my first websockets node.js and socket.io app, so I can communicate via javascript between a client and server. That works fine.

But I need something, that can communicate with a MySQL, so that for every change on a certain table, it has to tell the clients, that there is a change.

So I was thinking that the node.js server communicates with a PHP script that observes the database. But then I would also need long-pulling to request changes, so I could do it with ajax anyway, so it would be useless.

So my question: How can I achieve to get real-time data changes from a table of the database or from a certain query, which will send the update to all clients, that are connected in real-time, without long polling?

Thanks !

1 Answers
Related