我正在尝试获取节点(在 android 中并使用asmack
库)并尝试在该节点上发布一些内容,但不幸的是,当node = (LeafNode) mgr.getNode(nodeNameTxt.getText().toString());
行被执行时,我收到以下错误
No response from server.:
at org.jivesoftware.smackx.pubsub.packet.SyncPacketSend.getReply(SyncPacketSend.java:50)
at org.jivesoftware.smackx.pubsub.packet.SyncPacketSend.getReply(SyncPacketSend.java:61)
at org.jivesoftware.smackx.pubsub.PubSubManager.getNode(PubSubManager.java:161)
at com.bcl.NodeManager.publishNode(NodeManager.java:176)
at com.bcl.NodeManager.access$1(NodeManager.java:167)
at com.bcl.NodeManager$2.run(NodeManager.java:101)
at java.lang.Thread.run(Thread.java:1019)
这是我的代码
PubSubManager mgr = new PubSubManager(xmpp, "pubusb.example.com");
// Get the node
LeafNode node;
try {
//HERE I AM GETTING THE ERROR
node = (LeafNode) mgr.getNode(nodeNameTxt.getText().toString());
node.send(new PayloadItem("test" + System.currentTimeMillis(),
new SimplePayload("book", "pubsub:test:book", "")));
} catch (XMPPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
即使执行了下一行,我也会遇到相同的错误
createLeaf = mgr.createNode(nodeNameTxt.getText().toString());
我真的不知道发生了什么,因为我已经设置SmackConfiguration.setPacketReplyTimeout(10000);
并且服务器也使用 stophe javascript 示例运行良好。