title: PHP application + WebSocket based notifications over Socket.IO
body: <p>I have a web application written in PHP using laravel. </p>
  
  <p>Now, I have to add realtime notification system that pushes messages from server -> client, and can retrieve messages pushed from client -> server.</p>
  
  <p>Since Socket.IO is backwards compatible and degrades gracefully, I want to use it for the WebSocket / AJAX polling part.</p>
  
  <p>The problem is that Socket.IO by default works with Node.JS backend.</p>
  
  <p>I have root access to the server, there is no problem running both (Apache and Node) in parallel or adding anything extra.</p>
  
  <p>The problem is, <strong>how do I send a message from PHP to Node + Sockets.IO?</strong></p>
  
  <p>And then, <strong>how do I transfer a message from Sockets.IO + Node to PHP?</strong></p>
  
  <p>I have left the Node + Sockets to Browser part out, because that's pretty straight forward.</p>
  
  <p>I have seen examples utilising <a href="https://stackoverflow.com/questions/11550103/push-notifications-using-socket-io-and-php">Express.js + CURL and/or POST requests</a>, but, isn't there a lower level way of doing it?</p>
  
  <p>I am aware of <a href="http://bergie.iki.fi/blog/dnode-make_php_and_node-js_talk_to_each_other/" rel="nofollow noreferrer">DNode + PHP</a>, but I cannot imagine how to assemble everything - Apache, PHP, Node, Socket.IO, DNode so it would work together seamlessly.</p>
  
  <p>Also, I have transformed into a laravel library this <a href="https://github.com/lemmingzshadow/php-websocket" rel="nofollow noreferrer">PHP WebSockets server</a> implementation. The problem with this library, though, is that it utilizes clean WebSockets for it's client side. And, I couldn't find a way to hack it together with <a href="https://github.com/LearnBoost/socket.io-client" rel="nofollow noreferrer">Socket.IO client</a>.</p>