Myself and a friend have started making a game, he's likely to be using impact.js for the user interaction etc, but we need multiplayer functionality so some form of websockets for TCP connections etc. So we were thinking impact.js into socket.io and node.js. However, user accounts, ecommerce, session handling and social media integration will all be handled with Codeigniter (PHP), my question is, is it wise to have node.js running in parallel with Codeigniter, or if this is even possible? If not, if you were to create a multiplayer online game utilising ecomms to buy credits and user accounts, how would you go about this from a structural position and what engines/frameworks would you recommend? I'm new to this site so I apologise in advance if I'm posting something inappropriate.




It is entirely possible to have nodejs and CodeIgniter (or any other web server framework) running at the same time. They do need to be running on different ports, or they need to have a reverse proxy (using Apache, nginx, lighttpd, etc.) to host them on different paths on the same host+port.

Sharing data between CodeIgniter and nodejs can be done by simply using the same database for both. You can also allow the nodejs service to make HTTP requests to your CodeIgniter backend, by creating a Web API for your backend services' needs.

Your other questions ("what tech do I use" and "how do I get started with this") are off-topic for GDSE. Really, though, use whatever libraries or tech you want. The core of your architecture is going to just be simple HTTP requests, a database, and a WebSocket server. How any of those pieces are implemented isn't really important.

  • \$\begingroup\$ I tried to use apache as a reverse proxy for websocket once. It didn't work because it ate the Upgrade header. But that was a half year ago. Did they fix that by now? \$\endgroup\$ – Philipp Dec 4 '12 at 19:22
  • \$\begingroup\$ @Philipp: I don't know. It may need a module or something to get it working if it doesn't work out of the box. A quick Google search brought this up: github.com/disconnect/apache-websocket \$\endgroup\$ – Sean Middleditch Dec 4 '12 at 19:25
  • \$\begingroup\$ I also took a look at that. It forwards websocket traffic to a shared library you have to implement yourself. When you would want to use it as a reverse proxy, you would have to write most of the proxy logic yourself. I discarded that, because then I could just as well write my own reverse proxy from scratch. I wrote a post on my development blog about potential alternatives: ontraindevelopment.blogspot.de/2012/06/… \$\endgroup\$ – Philipp Dec 4 '12 at 19:30
  • \$\begingroup\$ Nginx is the one I see used most often, so it's probably the safest bet. I haven't used it much myself though so I can't really give any more advice on it. :) \$\endgroup\$ – Sean Middleditch Dec 4 '12 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.