Closed agnauck closed 5 years ago
WS Server not change stanzas, it only forwards them. Look your XMPP server
WS Server not change stanzas, it only forwards them
this is exactly the issue when you forward the complete text of a stanza without referencing it to the complete XMPP stream.
Here is a pseudo stream.
<stream:stream
from='example.com'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'
version='1.0'>
<iq type="set" id="578b0ba8-cb98-46a2-a383-3de028c081f9">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/>
</iq>
</stream:stream>
the default namespace is defined on the stream header (jabber:client). It gets inherited by default to all child stanzas, this is why it is omitted on the iq stanza in this sample here.
By just forwarding the text/string of the stanza you are putting it in the default XML namespace, instead of the jabber:client namespace on the websocket connection.
Stanzas in websocket frames must be independently parsable XML documents, and also conform to the namespaces defined in the XMPP core specs. This is why you have to rewrite the stanza and add the namespace back. By not doing this the implementation will not be compatible with fully namespace aware client implementations, while it still may work with implementations which are not that strict.
fixed in version 0.1.2
the jabber:client namespace is missing on stanzas. This causes several clients and libraries fail to connect.
See here from a log from stanza.io which hangs on resource binding because its namespace aware and expects the response Iq to be in the jabber:client xml namespace: