I'm here, because I would like to ask how can I possibly implement two-way communication between PHP & Node.js. The scenario is as follows:Currently I only use PHP -> Node.js communication via Redis Pub/Sub, so whenever a call to PHP script is made that requires sending some information to other users, message is published to specific Redis channel (I use one channel per user) from PHP, then node.js app receives this message being subscribed to that channel and send it to the user using socket.io. The only thing node.js app is aware is socket - user binding created by retrieving PHP session (stored in Redis) based on cookies.At this moment I would like to add few more real-time features that requires more information stored in my MySQL database that PHP application uses.The question here is simple. How to supply Node.js app with information from PHP application (well, MySQL database used by it)? I am looking for anwsers that focus on two particular aspects: performance and infrastructure-independency / flexibility (right now they are al on same server, but it will change in production environment).I know one of the most flexible ways would be creating an API, but that seems much less performant and secure (additional HTTP requests & the need to authenticate the API calls) than querying the database directly from Node.js app.
PHP and Node.js-powered WebSockets communication
php;rest;web applications;node.js;web api