How to send / receive customize item on pubsub node with payload, I am using qsmack lib.
here is my code.
StringBuilder strBuffer = new StringBuilder();
strBuffer.append("<x xmlns=");
strBuffer.append("jabber:x:data");
strBuffer.append(">Test</x>");
String xml = strBuffer.toString();
SimplePayload item = new SimplePayload("test1111","pubsub_test_book", xml);
// Publish an Item with payload
leafNode.send(new PayloadItem<SimplePayload>("test123", item));
when I am trying to send payload item on node, I got an error message from server no response from server and connection disconnected.
After long try , I found answer how to send and receive payload on pub sub node. While creating pubsub node I am using ConfigureForm, that will create a problem in my case. So I am creating node without configuration form.
mLeafNode = (LeafNode) mPubSubManager.createNode(nodeId);
It will solved my problem. Now I can send and receive payload item.
SimplePayload item = new SimplePayload("test1111","pubsub_test_book", xml_string);
leafNode.send(new PayloadItem("test123", item));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With