2

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

Nasreddine
  • 36,610
  • 17
  • 75
  • 94
Chris
  • 4,255
  • 7
  • 42
  • 83
  • Stackoverflow is not a recommendation engine, you should find the answer yourself. We expect objective questions with objective answers here. However, you can learn nodejs and build the system on a nosql database, however this might not be portable because most forums are hosted on PHP only hosts, that don't give you additional access to setup Node etc. So if you want a larger audience stick with your PHP-MySQL solution, optimize it – Mustafa Jun 04 '12 at 17:34
  • Well, I would like to know if sockets fit for this kind of chat. Because this chat will be on every page and not only on a single page. – Chris Jun 04 '12 at 18:01
  • please go accept answers to more of your questions. – Jason Jun 04 '12 at 18:22

1 Answers1

3

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 :).

Ozeetee
  • 126
  • 1
  • 5