Handle disconnects from XMPP, which I guess I wasn't doing.
This commit is contained in:
parent
1a49ebbc08
commit
2727180ea8
12
index.js
12
index.js
|
|
@ -608,6 +608,18 @@ xmpp.on("status", (status) => {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// If status is 'disconnect', attempt to reconnect after 5 seconds
|
||||||
|
if (status === 'disconnect') {
|
||||||
|
console.log(`${colors.yellow("[WARN]")} XMPP disconnected, attempting to reconnect in 5 seconds...`);
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log(`${colors.yellow("[WARN]")} Attempting to reconnect to XMPP...`);
|
||||||
|
xmpp.start().catch((err) => {
|
||||||
|
console.log(`${colors.red("[ERROR]")} XMPP failed to start: ${err}.`);
|
||||||
|
setTimeout(start, 5000);
|
||||||
|
});
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
xmpp.reconnect.on("reconnecting", () => {
|
xmpp.reconnect.on("reconnecting", () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue