Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Reconnect on Error? #71

Open
tfreedman opened this issue Mar 11, 2016 · 0 comments
Open

Reconnect on Error? #71

tfreedman opened this issue Mar 11, 2016 · 0 comments

Comments

@tfreedman
Copy link

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 : '[email protected]',
password : 'XXXXXXXX',
host : 'talk.google.com',
port : 5222
});

xmpp.subscribe('[email protected]');
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] } ] }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant