适用于 Node.js 的最佳 XMPP 客户端库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7967982/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 14:43:12  来源:igfitidea点击:

Best XMPP client library for Node.js

node.jsxmpp

提问by Denti

What are your experiences with Node.js XMPP client libraries? What do you recommend?

您对 Node.js XMPP 客户端库有什么体验?你有什么建议吗?

采纳答案by Jared Hanson

I would highly recommed node-xmpp, which is the most idiomatic library available for Node, in that each connection is an EventEmitter which emits events in a similar manner to the built in modules.

我强烈推荐node-xmpp,它是 Node 可用的最惯用的库,因为每个连接都是一个 EventEmitter,它以类似于内置模块的方式发出事件。

If you are coming at Node from a browser-based background, the way stanzas are constructed is identical to Strophe.js, which minimizes the learning curve.

如果您是从基于浏览器的背景开始使用 Node,那么构建节的方式与Strophe.js相同,这可以最大限度地减少学习曲线。

As you venture further into XMPP territory, node-xmpp is also a great way to write components. And its architecture is clean enough that there is even an xmpp-serverproject being built on it.

随着您进一步涉足 XMPP 领域,node-xmpp 也是编写组件的好方法。它的架构足够干净,甚至有一个xmpp-server项目正在构建在它上面。

Finally, I'm also developing Junction, which is a suite of XMPP middleware, similar in style to what Connect/Express offers for HTTP. I'm currently building out examples and additional documentation, but the source code has full API docs, and I think its a solid framework, particularly if you are incorporating various XEPs into your client/component.

最后,我还在开发Junction,它是一套 XMPP 中间件,在风格上类似于 Connect/Express 为 HTTP 提供的。我目前正在构建示例和其他文档,但源代码有完整的 API 文档,我认为它是一个可靠的框架,特别是如果您将各种 XEP 合并到您的客户端/组件中。

回答by Sudhanshu

If you are trying to build a bot for Google Talk, I would suggest using https://github.com/simple-xmpp/node-simple-xmpp

如果您正在尝试为 Google Talk 构建机器人,我建议您使用https://github.com/simple-xmpp/node-simple-xmpp

Node-xmpp did not work for me while connecting with google's servers.

与谷歌的服务器连接时,Node-xmpp 对我不起作用。