就像 Pablo 指出的那样,你可以看看 websockets 。但巴勃罗对 gmail 的了解有误。它不使用网络套接字。 Websocket 的主要缺点是浏览器支持。这是未来,但还不是现在。
错误的
轮询不会扩展。我不会推荐它。
XMPP/BOSH
Right now I would use XMPP/BOSH to write web-based IM. I found Prosody the easiest server that supports BOSH. Then you don't need to write any server-side code at all.
Like Pablo pointed out you could look at websockets. But Pablo is misinformed about gmail. It does not use websockets. The major drawback of websockets is browser support. It is the future, but not yet.
If you are looking to develop using PHP and little javascript, checkout Jaxl Framework for building web applications. http://github.com/abhinavsingh/JAXL
Use ejabberd/prosody as jabber server, they are stable and scalable enough to give you enough throughput.
Using websockets is surely recommended, but alas not all browsers support them till date.
发布评论
评论(3)
XMPP/BOSH
未来
错误的
XMPP/BOSH
The future
Wrong
使用 AJAX 来 ping 和更新数据库并不是一个很好的选择。
我建议您阅读有关 WebSockets 的内容。这就是 GMAIL 聊天(以及其他)的工作方式。
Using AJAX to ping and update a database is not a very good option.
I would suggest you reading about WebSockets. It's the way GMAIL's chat (among other) work.
如果您希望使用 PHP 和少量 javascript 进行开发,请查看用于构建 Web 应用程序的 Jaxl Framework。 http://github.com/abhinavsingh/JAXL
使用ejabberd/prosody作为jabber服务器,它们很稳定并且可扩展性足以为您提供足够的吞吐量。
当然建议使用 websockets,但遗憾的是到目前为止并非所有浏览器都支持它们。
If you are looking to develop using PHP and little javascript, checkout Jaxl Framework for building web applications. http://github.com/abhinavsingh/JAXL
Use ejabberd/prosody as jabber server, they are stable and scalable enough to give you enough throughput.
Using websockets is surely recommended, but alas not all browsers support them till date.