Reconnect on Error?
Opened this issue · 0 comments
I'm having a problem with a program I wrote not reconnecting in the event of a problem. The program handles other stuff as well as XMPP, so when the XMPP connection dies, the program itself stays alive. I'd like to prevent this scenario from occurring, so that XMPP reconnects on its own if there's a problem. Am I missing a line of code or anything to auto handle connection issues?
Code:
xmpp.on('online', function(data) {
console.log('Yes, I'm connected!');
console.log(xmpp.conn);
});
xmpp.on('error', function(err) {
console.error(err);
});
xmpp.connect({
jid : 'XXXXXXX@XXXXXXXX.com',
password : 'XXXXXXXX',
host : 'talk.google.com',
port : 5222
});
xmpp.subscribe('YYYYYYY@gmail.com');
xmpp.getRoster();
The last thing I saw before it died (from console.log(err)):
{ name: 'stream:error',
parent: null,
attrs: { 'xmlns:stream': 'http://etherx.jabber.org/streams' },
children:
[ { name: 'see-other-host',
parent: [Circular],
attrs: [Object],
children: [] },
{ name: 'str:text',
parent: [Circular],
attrs: [Object],
children: [Object] } ] }