是否有开源 WebSockets (JavaScript) XMPP 库?

发布于 2024-08-14 04:44:37 字数 1539 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

我的奇迹 2024-08-21 04:44:37

有多种解决方案(没有一个是完美的)

1. 使用Kaazing。

他们已经支持了。它是开源的,但他们有某种双重许可证,所以最好检查您是否可以用于您的项目。

2. 合并 js。 io 和 APE(​​Ajax Push Engine)

APE 是一个 Comet 框架,但他们最近开始支持 Websockets。
在他们的网站(“APE 作为代理”部分),他们说它可以运行包含 xmpp.js 的 js.io 库,因此将它们组合起来可能会起作用。

3. 使用 Caucho

它是一个类似于 APE 的基于 java 的框架,它提供一站式 Comet 解决方案,并且它们似乎支持 XMPP 和 WebSockets

4. 要求 Strope 团队支持 WebSocket。

Strope 通过 BOSH(通过同步 HTTP 的双向流)执行 XMPP,但有 还有关于支持 WebSockets 的讨论

Jack Moffitt(核心开发人员和上述书籍的作者)似乎对 WebSocket 感兴趣,但我们需要提供更强有力的推理来说明为什么他们需要支持 WebSocket 而不是 BOSH。如果您有好的答案,欢迎加入。

我刚刚尝试了他们的 xmpp,bosh,strope echobot 示例,效果很好。您可能还想尝试一下,看看它是否符合您的要求。

对于 #2 和 #3,他们说它们都支持 xmpp 和 websockets,但不确定它们是否可以一起工作。

您正在考虑使用 XMPP 和 XMPP 来实现什么样的应用程序? WebSockets 的用途?

以下是替代方案的建议。

当我写 这篇博文
如果您不时查看评论部分,一旦找到其他解决方案,我将发布更新。

There are multiple solutions (none of them are perfect)

1. Use Kaazing.

They already support it. It's open source, but they have some sort of dual license, so better to check whether you can use for your project or not.

2. Combine js.io and APE(Ajax Push Engine)

APE is a Comet framework, but they recently started supporting Websockets.
At their website("APE as proxy" section), they say it can run js.io libraries which includes xmpp.js, so combining them may work.

3. Use Caucho

It is a java based framework similar to APE which provides one stop shop Comet solution, and they seem to support both XMPP and WebSockets

4. Ask Strophe team to support WebSocket.

Strophe does XMPP over BOSH(Bidirectional-streams Over Synchronous HTTP), but there is a discussion about supporting WebSockets, too.

Jack Moffitt (the core developer and the author of the book mentioned above) seems interested in WebSockets, but we need to provide more strong reasoning about why they need to support WebSocket over BOSH. If you have good answers, please join the tread.

I just tried their xmpp,bosh,strophe echobot example, which worked nicely. You might also want to try it to see if it fits your requirement or not.

For #2 and #3, they say that they both support xmpp and websockets, but not sure if they work together.

What kind of application you are thinking about using XMPP & WebSockets for?

The below are suggestions for alternatives.

  • If you want the presence, chat, chat room equivalent functionality, you could make Wave Gadget or Robot, then expose to outside using Wave Embed API(dead link, kept for historic purposes). Wave is actually built on top of XMPP.
  • If you are simply looking for very low latency messaging capability, you could try AMQP.
  • If you are looking for much simpler message streaming, you can just pipe in/out unix file as I demonstrated here.

I got most of the information above when I wrote this blog post.
If you check the comment section time to time, I will post update once I find other solutions.

挽清梦 2024-08-21 04:44:37

我们还没有基于 WebSockets 的 XMPP 标准服务器可以实现,这在客户端得到充分处理之前是必需的。

第一步是完成WebSocket标准化。看起来这可能会在 IETF HyBi 工作组中发生,但在撰写本文时尚未得到 IESG 的批准。几周前,在广岛 IETF 会议上召开了 HyBi Birds-of-a-Feather (BoF)(请参阅 会议材料),进展顺利。

在 WebSockets 有了稳定的引用并且似乎稳定下来之后, XSF 将创建一个 XEP 将 XMPP 绑定到 WebSocket,大概每个 WebSocket 帧都有一个节。

编辑:Jack Moffitt 编写了一份 IETF 互联网草案 首次通过可使用的协议。 警告。这种情况仍有可能发生巨大变化。仅当您愿意稍后将其完全删除时才实施它。 警告

We don't yet have a standard for XMPP over WebSockets that the servers can implement, which will be required before the client side can be tackled adequately.

The first step is to finish WebSocket standardization. It looks like this may happen in an IETF HyBi working group, which at the time of writing has not yet been approved by the IESG. There was a HyBi Birds-of-a-Feather (BoF) at the Hiroshima IETF meeting a couple of weeks ago (see the meeting materials), which went pretty well.

After WebSockets has a stable reference, and seems to be settling down, the XSF will create a XEP that binds XMPP to WebSockets, presumably with a stanza per WebSocket frame.

Edit: Jack Moffitt has written an IETF Internet-Draft with a first pass at a protocol that can be used. WARNING. This is still likely to change drastically. Only implement it if you're willing to rip it out completely later. WARNING.

灵芸 2024-08-21 04:44:37

即将出版一本书,涵盖该主题...

使用 JavaScript 和 jQuery 的专业 XMPP
替代文本 http://ecx.images-amazon.com/images/ I/51B7VAHw8OL._SL500_AA240_.jpg

但我假设您不想等待这本书。因此,请观看 JSConf 中 Jack Moffitt 的演示。我今天早上看了。 (Jack Moffitt 是上面链接的书的作者。)

涉及的库(JavaScript 和 C 实现)是 Strope

这是一个非常富有成效的探索领域,但也非常原始。我们很快就会看到更多。 WebSockets 是 HTML5 带来的,对吗?

There's a book coming soon that covers this topic...

Professional XMPP with JavaScript and jQuery
alt text http://ecx.images-amazon.com/images/I/51B7VAHw8OL._SL500_AA240_.jpg

But I'm assuming you don't want to wait for the book. So watch the Jack Moffitt's presentation from JSConf. I watched it this morning. (Jack Moffitt is the author of the book linked to above.)

The library involved (JavaScript and C implementations) is Strophe.

This is a very fruitful area of exploration, but very raw. We'll see more soon. WebSockets come with HTML5, is that right?

花海 2024-08-21 04:44:37

JSJaC 实现 XMPP Over Websocket。众所周知,它可以与多种后端实现一起使用:

  • node-xmpp-bosh -
    支持 RFC6455 并且自 0.6.1 以来工作没有任何问题,它还
    如有必要,透明地使用 STARTTLS
  • wxg - 支持 RFC6455 并有效
    没有问题,但无法连接到需要的服务器
    STARTTLS(原来的wxg有一些
    问题,已由 Gordin 解决)。
  • ejabberd-websockets - 不
    支持 RFC6455 因此它不起作用,调整它以支持
    对于了解 Erlang 的人来说,RFC6455 应该很容易(一些工作
    正在进行中,可以在 github 上找到)
  • Openfire -
    非官方插件可用,但缺乏支持
    对于 RFC6455 因此它不起作用
  • Apache Vysper - 确实
    不支持 RFC6455,因此 Tigase 不起作用
  • - WebSocket 上没有已知的工作
    支持
  • MongooseIM - ejabberd 的一个分支
    支持基于 Websockets 的 XMPP。

JSJaC implements XMPP Over Websockets. It's known to work with several backend implementations:

  • node-xmpp-bosh -
    supports RFC6455 and works with no problems since 0.6.1, it also
    transparently uses STARTTLS if necessary
  • wxg - supports RFC6455 and works
    with no problems, but cannot connect to servers requiring
    STARTTLS (original wxg has some
    issues, that were fixed by Gordin).
  • ejabberd-websockets - does not
    support RFC6455 hence it does not work, adapting it to support
    RFC6455 should be quite easy for anyone knowing Erlang (some work
    in progress can be found on github)
  • Openfire -
    unofficial plugin is available, but it lacks support
    for RFC6455 hence it does not work
  • Apache Vysper - does
    not support RFC6455 hence does not work
  • Tigase - no known work on WebSocket
    support
  • MongooseIM - a fork of ejabberd
    with support for XMPP over Websockets.
假装不在乎 2024-08-21 04:44:37

我不确定浏览器端的 JS 是否可以单独处理 websocket 协议,因为它主要依赖于浏览器 API。目前还很少有浏览器支持 websocket:Chrome、Safari5,也许还有 Firefox4。有很多基于 flash/as3 的解决方法(然后你的 js 与 flash 代码通信),主要限制是 flash 不支持安全连接(太糟糕了)。

BWT,你可以检查 这个 websocket implem 他们提供开源 Java websocket 客户端库并且似乎可以处理xmpp 的东西,如果您浏览存储库,您可能会找到基本的 as3 websocket 实现。

I'm not sure JS on browser side can handle websocket protocol alone as it mostly rely on browser API. Few browser support websocket yet: Chrome, Safari5, maybe Firefox4. There are many workarounds based on flash/as3 (then your js communicates with flash code) the the main limitation is that flash does not support secure connection (too bad).

BWT, you can check this websocket implem they provide opensource Java websocket client lib and seems to deal with xmpp stuff and if you browse the repositories you might find basic as3 websocket implementation.

佼人 2024-08-21 04:44:37

我不确定您为什么专门要求 WebSocket 解决方案,因为 XMPP 服务器必须首先支持此解决方案。

然而,有几个可用的 XMPP JavaScript 库(据我所知,它们都使用 BOSH 方法):

这些示例取自 XMPP 网站其中列出了 XMPP 协议的开源实现。

I am not sure why you are asking specifically for a WebSocket solution because the XMPP servers would have to support this first.

However there are several XMPP JavaScript libraries available (as far as I see they all use the BOSH method):

These examples were taken from the XMPP Website which lists open source implementations of the XMPP protocol.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文