The website has a classic LAMP setup and runs on a virtual private server. The aim is to add an HTML5 multiplayer game which runs on the same domain, has latency of up to 500ms, maintains state on the server side and can support a few thousand concurrent games with 2-5 players per game at peak times.
Since I had little experience with PHP and server side in general, my original plan was write a game demo in node.js+socket.io and rewrite it in PHP later on. However, now that I've written the demo (~400 lines of code on the server side) I have doubts about the plan. There are two ways of integration that I am considering:
pros:
cons:
Since the site is hosted on a VPS, I think I can put nginx in front of Apache and node.js so that the client will only have to use single port on a single domain.
pros:
cons:
As I said, I have little experience with server side, although making the demo helped a lot. Are there better ways of doing this? Did I miss out important pros/cons? Which points are the most important in practice?