k-yle / sACN

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

✨ handle resend errors #62

Closed lukas-runge closed 1 month ago

lukas-runge commented 1 month 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 1 month 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