Backend server software for facebook-like chat with PHP/MySQL/JS?

自作多情 提交于 2019-12-14 02:09:32

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/10885445/backend-server-software-for-facebook-like-chat-with-php-mysql-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!