You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are using private functions (with underscore), which don't work as you would expect. Also, namespaces in XML are not ordinary attributes, you cannot get them to work properly by setAttribute. Just stick to the public methods:
var p = new JSJaCPresence();
var c = p.buildNode("c", {"xmlns": "http://jabber.org/protocol/caps"});
c.setAttribute("ver", "1.0");
c.setAttribute("node", "http://example.net/caps");
p.appendNode(c);
console.log(p.xml());
In case of IQ, the output is actually correct. You have created methodCall with empty namespace, so if it append to to an element with jabber:iq:rpc default namespace, empty xmlns is created. You must specifiy XML namespace for every element you create (as said above, XML namespaces are not simple attributes).
var iq = new JSJaCIQ();
iq.setType("set");
iq.setQuery("jabber:iq:rpc");
iq.getChild().appendChild(
iq.buildNode("methodCall", {"xmlns": "jabber:iq:rpc"}, [
iq.buildNode("methodName", {"xmlns": "jabber:iq:rpc"}, "foo"), []]));
console.log(iq.xml())
I've a problem when generating custom packets in firefox (18.0.1 in this case). For example here's code that adds capabilities:
This works fine in Chrome - it sends:
Firefox tries to send:
which gets lost on the way somewhere - I'm not getting PEP notifications I'm registered for.
There seem to be more strange namespace problems in firefox:
Firefox adds a xmlns='' to methodCall which makes the receiving entity reject the packet.
Did I miss something in my code? Any idea why that happens?
The text was updated successfully, but these errors were encountered: