Nice write-up, the sensor and router framing is a good way to think about it. Two things worth adding before running this unattended: the plain WebSocket has no reconnect, and Binance closes every connection after 24 hours, so the watcher quietly stops. Also, price > 100000 fires on every tick above the line, so the agent gets spammed (you mention debouncing; an edge check covers most of it).
Disclosure: we maintain the binance npm SDK, which handles heartbeats, reconnects and resubscribes. The same watcher with it:
Thanks for sharing the feedback! I was already planning a few updates to these write-ups and will definitely take the pointers you shared into consideration. Really appreciate you taking the time to share these insights!
Siebly
Nice write-up, the sensor and router framing is a good way to think about it. Two things worth adding before running this unattended: the plain WebSocket has no reconnect, and Binance closes every connection after 24 hours, so the watcher quietly stops. Also,
price > 100000fires on every tick above the line, so the agent gets spammed (you mention debouncing; an edge check covers most of it).Disclosure: we maintain the
binancenpm SDK, which handles heartbeats, reconnects and resubscribes. The same watcher with it: