Question

I developed a Facebook-like chat in PHP and JavaScript. It's a plugin for a forum software. Currently I'm using (short) polling to receive new messages, but I'd like to try it with something better, like sockets.

What would you recommend for this kind of chat (available on every site, private chat, group chat..) : WebSockets, node.js with socket.io, ejabberd...

Facebook-like chat

Was it helpful?

Solution

From my personal experience there are no good socket library available for PHP. Usually one wants to have a socket library which will have fallback mechanisms if native socket support is not available. 2 suggestions from me :

  1. Switch completely to node.js + Socket.io solution, discard PHP.
  2. Have a nodejs + socket.io chat system running as a separate server along with PHP. Put HAPROXY in front of your webserver. Divert all socket request to node.js and all other request to PHP. In this way you will be able to use the goodies of both node.js and PHP.

I had a similar situation and I am using option 2 :).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top