mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
xmpp disconnect more cleanly/correctly
This commit is contained in:
parent
9db89f3ea1
commit
a9d1ca0491
@ -211,18 +211,18 @@ module.exports = function(RED) {
|
||||
for (const room of rooms) {
|
||||
await that.client.send(xml('presence', {to:room, type:'unavailable'}));
|
||||
}
|
||||
// if (that.client.connected) {
|
||||
await that.client.send(xml('presence', {type:'unavailable'}));
|
||||
try{
|
||||
if (RED.settings.verbose || LOGITALL) {
|
||||
that.log("Calling stop() after close, status is "+that.client.status);
|
||||
if (that.connected) {
|
||||
await that.client.send(xml('presence', {type:'unavailable'}));
|
||||
try{
|
||||
if (RED.settings.verbose || LOGITALL) {
|
||||
that.log("Calling stop() after close, status is "+that.client.status);
|
||||
}
|
||||
await that.client.stop().then(that.log("XMPP client stopped")).catch(error=>{that.warn("Got an error whilst closing xmpp session: "+error)});
|
||||
}
|
||||
catch(e) {
|
||||
that.warn(e);
|
||||
}
|
||||
await that.client.stop().then(that.log("XMPP client stopped")).catch(error=>{that.warn("Got an error whilst closing xmpp session: "+error)});
|
||||
}
|
||||
catch(e) {
|
||||
that.warn(e);
|
||||
}
|
||||
// }
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-node-xmpp",
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.2",
|
||||
"description": "A Node-RED node to talk to an XMPP server",
|
||||
"dependencies": {
|
||||
"@xmpp/client": "^0.12.0"
|
||||
|
Loading…
Reference in New Issue
Block a user