k-yle / sACN

💡 🎭 Send & Receive sACN data (DMX over IP) in node.js
https://npm.im/sacn
Apache License 2.0
31 stars 13 forks source link

✨ handle resend errors #62

Closed lukas-runge closed 3 months ago

lukas-runge commented 4 months ago

Hi @k-yle,

when using the minRefreshRate feature to resend packets continuously the socket might throw errors. One example would be disconnecting and reconnecting the ethernet connection. In this case the unhandled error would crash the whole application and there would be no way for users of the library to catch those and handle those appropriately. This is why I implemented two events that help users handling those cases:

  1. error: contains the Error object for further handling
  2. changedResendStatus: to gracefully recover from disconnection events without necessarily needing to destroy and recreate the Sender instance.

Best regards, @lukas-runge

lukas-runge commented 3 months ago

Hi @k-yle,

thank you for your feedback! 💯 I've just implemented your suggestions! 🧑‍💻 I think the branch should be ready to merge now. 🚀 What do you think? 🙌

Best regards, @lukas-runge