Send stanza created from string

53 views
Skip to first unread message

John Doe

unread,
Feb 21, 2021, 6:11:29 PM2/21/21
to Strophe

I am trying to make a XMPP console for debugging purposes and the stanzas need to be written as XML strings rather than using the Strophe Builder.

Let's say I have this string example from a book

```xml
<iq to="pemberley.lit" from="eliz...@longbourn.lit/lambton" type="get" id="info1">
 <query xmlns="http://jabber.org/protocol/disco#info"/>
</iq>
```

and when I want to send that string I do

```javascript
const parser = new DOMParser();
const elem = parser.parseFromString(stanza, "application/xml");
service.send(elem);
```
where `stanza` is the above XML string and service is a Strophe.Connection

but that fails with `strophe.umd.js:3242 Uncaught StropheError: Cannot queue non-DOMElement`

I already found this previous conversation https://groups.google.com/g/strophe/c/9pADmOe1qpQ/m/lPKWa7pXHXkJ but I don't understand what do I have to do.


Reply all
Reply to author
Forward
0 new messages