Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未实现nodejs xmpp android的功能_Android_Node.js_Xmpp - Fatal编程技术网

未实现nodejs xmpp android的功能

未实现nodejs xmpp android的功能,android,node.js,xmpp,Android,Node.js,Xmpp,我正在尝试创建一个聊天应用程序,使用Google消息服务和nodejs xmpp服务器。 所以我使用了android应用程序的api 我不知道为什么,但服务器正在发送一节说功能未实现 我为连接xmpp服务器而编写的android代码 XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder() .setServiceName("localhost")

我正在尝试创建一个聊天应用程序,使用Google消息服务和nodejs xmpp服务器。 所以我使用了android应用程序的api

我不知道为什么,但服务器正在发送一节说功能未实现

我为连接xmpp服务器而编写的android代码

XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
                    .setServiceName("localhost")
                    .setHost(IPADRESS)
                    .setPort(5222)
                    .build();
            AbstractXMPPConnection conn2 = new XMPPTCPConnection(config);
            conn2.setPacketReplyTimeout(1000);
            SmackConfiguration.DEBUG = true;
            conn2.connect();

            conn2.login(mngr.getDeviceId(), "secret");
nodejsxmpp服务器模块

var startServer = function (done) {
  // Sets up the server.
  server = new xmpp.C2S.TCPServer({
    port: 5222,
    domain: 'localhost'
  })

  // On connection event. When a client connects.
  server.on('connection', function (client) {
    // That's the way you add mods to a given server.

    // Allows the developer to register the jid against anything they want
    client.on('register', function (opts, cb) {
      console.log('REGISTER')
      cb(true)
    })

    // Allows the developer to authenticate users against anything they want.
    client.on('authenticate', function (opts, cb) {
      console.log('server:', opts.username, opts.password, 'AUTHENTICATING')
      if (opts.password === 'secret') {
        console.log('server:', opts.username, 'AUTH OK')
        cb(null, opts)
      } else {
        console.log('server:', opts.username, 'AUTH FAIL')
        cb(false)
      }
    })

    client.on('online', function () {
      console.log('server:', client.jid.local, 'ONLINE')
     client.send("")

    })

    // Stanza handling
    client.on('stanza', function (stanza) {
      console.log('server:', client.jid.local, 'stanza', stanza.toString())
      var from = stanza.attrs.from
      stanza.attrs.from = stanza.attrs.to
      stanza.attrs.to = from
      client.send(stanza)
    })
    // Stanza handling
    client.on('chat', function (stanza) {
      console.log('server:', client.jid.local, 'chat', stanza.toString())
      client.send(stanza)
    });

    // On Disconnect event. When a client disconnects
    client.on('disconnect', function () {
      console.log('server:',  'DISCONNECT')
    })
  })

  server.on('listening', done)
}
startServer(function (){

    console.log("server localhost started at 5222 localport");
});
nodejs服务器控制台输出

server localhost started at 5222 localport
server: 354223060799129 secret AUTHENTICATING
server: 354223060799129 AUTH OK
server: 354223060799129 ONLINE
server: 354223060799129 stanza <iq id="eW469-5" type="get" xmlns:stream="http://etherx.jabber.org/streams" from="354223060799129@localhost/Smack"><query xmlns="jabber:iq:roster"/></iq>
server: 354223060799129 stanza <presence id="eW469-6" xmlns:stream="http://etherx.jabber.org/streams" from="354223060799129@localhost/Smack"/>
server: 354223060799129 stanza <iq id="eW469-5" type="error" xmlns:stream="http://etherx.jabber.org/streams" from="354223060799129@localhost/Smack"><error type="cancel"><feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

在stackoverflow中,我尝试了很多类似问题的解决方案,但都没有成功。请给予帮助

链接的节点XMPP服务器项目不是完整的XMPP服务器。它是一个XMPP服务器库,可以帮助您使用node.js构建XMPP服务器

在您的日志中,当您尝试请求花名册(联系人列表)时,它将返回未实现的异常


您要么必须在Javascript中实现所需的所有功能,要么选择另一个现有功能完整的XMPP软件。

我是XMPP新手。如何实现XMPP功能。是否有文档?请访问此处:学习RFC 6120和6121。或者正如我所建议的,从一个完整的XMPP服务器开始。你可以在这里找到一些选择:谢谢。是否有关于使用现有服务器和编写我们自己的服务器的文档?
03-10 22:57:12.598 8126-8183/gcm.play.android.samples.com.gcmquickstart E/AbstractXMPPConnection: Exception in packet listener
                                                                                                  java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
                                                                                                      at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:746)
                                                                                                      at org.jivesoftware.smack.roster.Roster$PresencePacketListener.getUserPresences(Roster.java:1134)
                                                                                                      at org.jivesoftware.smack.roster.Roster$PresencePacketListener.processPacket(Roster.java:1157)
                                                                                                      at org.jivesoftware.smack.AbstractXMPPConnection$4.run(AbstractXMPPConnection.java:1156)
                                                                                                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                                      at java.lang.Thread.run(Thread.java:818)
03-10 22:57:12.598 8126-8185/gcm.play.android.samples.com.gcmquickstart E/Roster: Exception reloading roster
                                                                                  XMPPError: feature-not-implemented - cancel
                                                                                      at org.jivesoftware.smack.AbstractXMPPConnection$5.processPacket(AbstractXMPPConnection.java:1448)
                                                                                      at org.jivesoftware.smack.AbstractXMPPConnection$3.run(AbstractXMPPConnection.java:1126)
                                                                                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                      at java.lang.Thread.run(Thread.java:818)