PHP Jquery: chat system, what is the Ideal framework for this?

纵饮孤独 提交于 2019-12-05 07:47:20
Rok Kralj

PHP and Comet are not mutually exclusive. Comet is just a technique of server push, so you don't have to poll ever second. You implement Comet in PHP & JS, it is not a separate programming language.

Although: I DO NOT recommend programming chat on your own, unless you need very specific features. It is time consuming and error prone. Use one of the pre-made solution, for example:

http://www.phpfreechat.net/

or java IRC chatroom. Google for more.

leggetter

As Rok Kralj says Comet is a paradigm and can be applied to different technologies. The PHP & Comet question is a good place to start if you want to look into this.

It tends to be commonly agreed that PHP doesn't scale too well as a realtime technology. Facebook, who are a PHP house (although ended up compiling their PHP down to C (or maybe C++) for efficiency). The most common solution is to use dedicated realtime technology for your realtime communication and keep this outside of your web server.

In terms of technology choice I would consider WebSockets since they have become the standard for realtime bi-directional communication. Some 'Comet' servers use WebSockets as a transport too and fallback to the less efficient HTTP Streaming or HTTP Long-Polling for older browsers.

If you'd consider using a hosted service, and don't want to be tied to just chat functionality, would like realtime notifications, visual collaboration or gaming to be added to your app at some point, then http://pusher.com, who I work for, offer a hosted realtime messaging service which you can easily implement your chat functionality.

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