Closed uranik777 closed 3 years ago
Please format your issue correctly next time, see https://guides.github.com/features/mastering-markdown/
xmpp.js implements reconnect by default - you are probably messing with it
See https://github.com/xmppjs/xmpp.js/tree/master/packages/client and https://github.com/xmppjs/xmpp.js/tree/master/packages/reconnect
it would still be good to catch the exception
(node:3432) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cl
i_unhandled_rejections_mode). (rejection id: 67)
node_modules/@xmpp/connection/index.js:49
this.parser.write(str);
TypeError: Cannot read property 'write' of null
i had to change the code to this:
if(this.parser){
this.parser.write(str);
}
That's a different issue, see https://github.com/xmppjs/xmpp.js/issues/866
BTW it's your application job to catch exceptions. xmpp.js can and will throw when an error occurs.
sometimes the nodejs program crashes on reconnect attemt
await xmpp.stop(); while(xmpp.status!=='offline'){ await sleep(500); } try{ await xmpp.start(); // <<< unhandled error here (I do not know why error not catch in try block) }catch (e) { console.error(e);
}
with error: (node:10315) UnhandledPromiseRejectionWarning: Error [ERR_STREAM_WRITE_AFTER_END]: write after end at writeAfterEnd (_stream_writable.js:266:14) at TLSSocket.Writable.write (_stream_writable.js:315:5) at /home/ubuntu/node/node_modules/@xmpp/connection/index.js:342:19 at new Promise ()
at Client.write (/home/ubuntu/node/node_modules/@xmpp/connection/index.js:334:12)
at Client.open (/home/ubuntu/node/node_modules/@xmpp/connection/index.js:266:16)
at Client.start (/home/ubuntu/node/node_modules/@xmpp/connection/index.js:216:16)