tmijs / tmi.js

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)
https://tmijs.com
MIT License
1.54k stars 216 forks source link

Client should check wasCloseCalled flag on error before reconnecting #482

Closed char-khan closed 2 years ago

char-khan commented 2 years ago

If error occurs while disconnecting, client tries to reconnect. This happens when disconnect() is called before connection is complete as below.

const client = new tmi.Client({
  options: { debug: true }
});
client.connect().catch(console.error);
client.disconnect()

I'm not sure if there are any other cases that disconnect() causes error, but client should check to see if the user is trying to disconnect, I think

AlcaDesign commented 2 years ago

Thanks!