I would recommend dnode-php to accomplish this. Dnode is an asynchronous rpc system for node.js that lets you call remote functions and dnode-php is the php implementation.
Is it possible that PHP to communicate with Node.js server in order to mimic real-time web apps developed completely in PHP+Apache+MySQL?
My thinking is this:
Two users, John and Adam, are viewing the same page where you can write comments.
- John writes a comment and hits submit.
- The comment is POSTed to PHP
- PHP saves the message in a database and Memcached
- PHP communicates with Node.js to update the comments page
- Node.js opens a socket (or other transport method with Socket.io) and updates the comments page in the browser.
- Adam sees a new comment added on the page in 'real-time'
I want to do this because it's much easier for me to work with PHP instead of handling all server-side stuff with node.js. And I don't want to change my whole world of PHP app to Node.js. Any good code example? or article?