php website with node.js daemon concurrently

I am creating a website in PHP (static, preprocessed pages and everything PHP-ish) BUT,

I would like to add some real-time functionalities like, say, a notification function, by using Node.JS with Socket.IO.

So it's basically a PHP website but with a Node.js daemon that pushes some data via socket.io.

I played around with it a bit, and all honestly, it doesn't seem that hard at all.

It's more of a curiosity, but do you think that it might be a good combination to have them together, by adding the Socket.IO javascript on the client to listen to server-side notifications?

Thanks in advance.


Also, I noticed that, when I require socket.io on the server, it puts the script on the client side too. As I will not be using node to serve pages, I suppose that the script will not be included in the page. Is there a way to include it manually?

Sorry for my English, I'm not native.

If you don't need node to serve pages, you can just include socket.io and connect to the socket server.

In your client, add:

<script src="[server address]:[server port]/socket.io/socket.io.js"></script>

And then:

var socket = io.connect([server address]:[server port]);