Can XMPP be used like Comet's http long wait?

半腔热情 提交于 2019-12-06 00:18:34

问题


Can XMPP be applied in a similar way to the reverse Ajax pattern? Can it be used to implement http long wait like Comet? Is there an example of using such a technique with XMPP?


回答1:


Yes. Take a look at XMPP over BOSH. It's a long-lived non-polling technique. From the BOSH specification:

This specification defines a transport protocol that emulates the semantics of a long-lived, bidirectional TCP connection between two entities (such as a client and a server) by efficiently using multiple synchronous HTTP request/response pairs without requiring the use of frequent polling or chunked responses.

jbosh is an open source Java implementation. Tigase.org has a number of projects, including BOSH support, and appears to be mostly Java/GWT. JAXMPP is a Java library in the framework, although it's not clear what feature set it supports. I've not tried any of these myself.




回答2:


  • Like Ire told you can use bosh for that. On the client-side(javascript) you could use strophe.js.
  • Prosody is an easy to install XMPP-server which supports BOSH.
  • To learn how to create programs using strophe.js you could read Professional XMPP programming with javascript and Jquery


来源:https://stackoverflow.com/questions/1366219/can-xmpp-be-used-like-comets-http-long-wait

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