通过Node.js上的XMPP连接到Google Talk [英] Connecting to Google Talk over XMPP on Node.js

查看:99
本文介绍了通过Node.js上的XMPP连接到Google Talk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试过将多种XMPP库用于Node.js,但无法连接到Google Talk的XMPP服务器.我想联系并阅读朋友的状态,但我什至无法走出去!

I've tried using a variety of XMPP libraries for Node.js, and am having trouble connecting to Google Talk's XMPP servers. I'm wanting to connect and read the status of friends, but I can't even get out door!

  1. 我有一个通过Google Apps for Domains托管的个人域,例如mydomain.com.
  2. 我已经编写了以下代码-它使用了node-xmpp库( https://github .com/astro/node-xmpp ):

jid = 'ryan@mydomain.com';
password = 'my_google_password';

// Establish a connection
var conn = new xmpp.Component({
    jid         : jid,
    password    : password,
    host        : 'talk.google.com',
    port        : 5222
});
conn.on('online', function(){
    sys.put("ONLINE");        
});
conn.on('error', function(e) {
     sys.puts(e);
});

已建立连接,但身份验证失败,并且我从Google Talk收到了以下消息:

A connection is established, but authentication fails, and I receive this message back from Google Talk:

<stream:error xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
    <not-authorized xmlns="urn:ietf:params:xml:ns:xmpp-streams"/>
</stream:error>

...我错过了什么吗?我尝试了其他库(https://github.com/mwild1/xmppjs),甚至是Python库,但仍然无法进行身份验证.我100%确定我的Google用户名和密码正确-有任何提示/想法吗?

...am I missing something? I've tried other libraries (https://github.com/mwild1/xmppjs), and even a Python library, and still haven't been able to authenticate. I'm 100% sure my Google username and password are correct - any tips/ideas?

推荐答案

弄清楚了.

我正在处理一些不准确的示例.

I was working with some inaccurate examples.

在上面的示例中,您需要更改:

In my example above, you'll want to change:

var conn = new xmpp.Component({...})

...到...

var conn = new xmpp.Client({...})

这篇关于通过Node.js上的XMPP连接到Google Talk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆