happyleavesaoc / python-limitlessled

MIT License
33 stars 22 forks source link

Keep alive packet frequency #14

Closed sidoh closed 7 years ago

sidoh commented 7 years ago

Looks like this is currently set to one second:

https://github.com/happyleavesaoc/python-limitlessled/blob/master/limitlessled/bridge.py#L26

This probably doesn't have any measurable negative effects, but thought I'd share some reasons it make make sense for this to be something closer to 5 seconds:

  1. The documentation suggests every 5 seconds.
  2. In practice, unrenewed sessions seem to stay active for something like 60 seconds.
  3. While it's probably insignificant in every regard that matters, it does contribute to congestion. The place this is likeliest to matter is on the hub which probably has relatively limited throughput. I'm using an ESP8266 as a Milight hub, and I've noticed a fair amount of UDP packets dropped when lots of stuff is sent at a time (up to 25% in the worst circumstances).
happyleavesaoc commented 7 years ago

@soldag

soldag commented 7 years ago

You convinced me ;) I don't even remember, why I chose one second. Just tested it out with 5 seconds and it worked fine.

Fixed in 6c92118cd3e3f55e18455775800f3099d4fdbda8.