Node.js + Socket.IO和CodeIgniter [关闭]

I am working on a project that's developed with the CodeIgniter framework. My project has a lot of user interaction like posts, comments, and other notifications that should be live.

I have tried by now to get those notifications in two ways:
1. I've tried to build a sort of data pull system with AJAX but in my opinion this was making lots of bandwidth waste on my server
2. I've set up a node.js with socket.io server, that only listens for some socket events and pushes the notifications back to the user. For example, when a comment is added, instead having a function that pulls all the new comments from 5 to 5 seconds, I'm having a socket.emit(); that pushes the comment information to node.js and node.js pushes the notification to all connected sockets.

I am not sure if node.js + PHP is a good job ( but, what I've learnt so far is that node.js is good for long polling and less resource costs ).

Witch architecture would you consider is better?

Use Node.js with Socket.IO to get any live data to your clients.

Yes, you can use this in conjunction with your CodeIgniter-based site... outputting dynamic pages and getting data client-side don't have to have anything to do with each other.

The issue you had with Socket.IO wasn't with Socket.IO itself... it's with how you built your application. Emit messages as you need to. If you need an initial emit with 5 comments upon connect, do that.

Once you have all the Nodejs + CI setup the next thing you will worry about is authenticating the users in Nodejs who are already authenticated in CI side. One way to overcome this by using custom session storage which can be accessed by both CI and Nodejs.

I chose Redis over Memcache for custom session storage because you don't want to lose all your existing session data on server restart. For CI https://gist.github.com/zhouming/3672207 and for Nodejs you can easily search, install and configure the Redis.

Refer here for more useful info http://ericterpstra.com/2013/03/use-redis-instead-of-mysql-for-codeigniter-session-data