xmppjs / xmpp.js

XMPP for JavaScript
ISC License
2.19k stars 372 forks source link

Sending IQ for in-band registration #828

Closed turanmehmetb closed 4 years ago

turanmehmetb commented 4 years ago

Hi, i need to implement in-band registration. So i should be able to send IQ to my host for registration.
const response = this.xmppClient.iqCaller.request( xml('iq', { type: 'get' }, xml('query', 'jabber:iq:register')), 30 * 1000, // 30 seconds timeout - default );

const response2 = this.xmppClient.iqCaller.request( xml('iq', { type: 'set' }, xml('query', { xmlns: 'jabber:iq:register', username: 'mbt', password: '123123'})), 30 * 1000, // 30 seconds timeout - default );

With two of these i could receive a result from my host, but in second result it says service-unavailable. I am sure that in my prosody config i've set 'allow_registration = true'. Am i wrong in the second IQ because i am not sure how to set values?