无法使用node-xmpp客户端连接到GCM [英] Can't connect to GCM using node-xmpp client

查看:152
本文介绍了无法使用node-xmpp客户端连接到GCM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用node-xmpp运行gcm服务器,但xmpp客户端似乎根本不会打开,并在超时后关闭。

I am attempting to run gcm server using node-xmpp, but xmpp client does not seem to open at all and closes after timeout.

var xmpp = require('node-xmpp-client');

var options = {
  type: 'client',
  jid: 'fake-project-123@gcm.googleapis.com',
  password: 'ApiKeyHere',
  port: 5235,
  host: 'gcm.googleapis.com',
  legacySSL: true,
  preferredSaslMechanism : 'PLAIN'
};

console.log("Creating XMPP Application");

var cl = new xmpp.Client(options);

cl.on('online', function()
{
    console.log("XMPP Online");
});

其余代码被省略。在控制台中,我永远不会看到XMPP Online。
如何检查xmpp是否连接,以及它无法打开?

Rest of the code was omitted. In the console, I never get to see "XMPP Online". How do I check if xmpp is even connecting, and where it fails to open?

推荐答案

问题,并发现Connection.startStream()从来没有被调用,虽然套接字已成功打开。

I got the same problem and found out that the Connection.startStream() was never called, although the socket was opened successfully.

这是我的拉请求:
https://github.com/node-xmpp/node-xmpp-client/pull/61

在合并之前,您可以使用我的fork,它应该可以用于GCM:
https://github.com/Riplexus/node-xmpp-client

Until it gets merged, you can use my fork, which should work for GCM: https://github.com/Riplexus/node-xmpp-client

这篇关于无法使用node-xmpp客户端连接到GCM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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