I'm trying to create a nodejs component using node-xmpp-component. But I keep getting error code 400, type modify, bad request, but I don't see anything wrong with my iq message.
My ejabberd configuration:
{5282, ejabberd_service, [
{ hosts, ["nodejs.myejabberddomain"], [{password, "admin"}] }
]}
My nodejs Component code:
var Component = require('node-xmpp-component')
, ltx = require('node-xmpp-core').ltx;
var component = new Component({
jid : "nodejs.myejabberddomain",
password : "admin",
host : "localhost",
port : "5282"
})
component.on('online', function() {
console.log('Component is online')
var iq = new ltx.Element('iq',{type:'set',id:'reg2', to: 'myejabberddomain'})
.c('query',{xmlns:'jabber:iq:register'});
component.send(iq);
})
component.on('error', function(e) {
console.error(e)
process.exit(1)
})
I'm not sure if I have any ejabberd configuration missing, or if I have any problem with my nodejs component connection or if this nodejs-xmpp-component is "broken"!
Anyone knows what I'm doing wrong? Any tips?
I've changed from ejabberd to prosody, but at first the registration was returning "service-unavailable".
So I had to go on prosody chat, and user called Zash helped me creating a module named mod_register_from_component.
In the lines 182 to 185 I changed the original mod_register to:
module:hook("iq/host/jabber:iq:register:query", function(event)
local session, stanza = event.origin, event.stanza;
if session.type ~= "component" then
Then in the prosody.cfg.lua in the modules_enabled I added my new module (and commented the original one)