Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idempotent discovery #92

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

travisghansen
Copy link

This PR introduces logic to ensure (as well as possible) idempotency of devices. It does this by utilizing a new uuid attribute on each device and ensuring that as new mdns or ssdp data arrives that the corresponding device simply has it's attributes updated if/when appropriate vs creating a new entry.

Various other features are peppered throughout:

  • 3 additional properties on each device: manufacturer, modelName, and lastSeen
  • devices can now be garbage collected (based on lastSeen attribute)
  • non-google devices are now properly discovered (ie: android tvs, etc)
  • new events for device_online and device_offline (garbage collected) and device_updated
    • existing device event behaves in a backwards-compatible way
    • more robust change detection logic has been put in place to prevent sending useless (actual noops) events
  • http.get usage now has proper error handling
  • http.get now has a configurable timeout setting to prevent hangs
  • streamType can be set when sending media
  • rinfo is used by default to detect mdns discovered host (vs parsing the foo.local address from DNS data)
  • added dev dependencies to support modern js formatting and linting

- formatting with prettier
- support setting streamType
- support using rinfo for mdns discovered host
- support setting a timeout on ssdp requests
- add eslint and prettier to dev deps

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
- prevent the same device from appearing multiple times
- include manufacturer, modelName, lastSeen in per-device data
- include options to gc devices not seen for a while
- include options to auto-update
- include options to enable/disable mdns/ssdp discovery
- refactor some internal naming for better code clarity

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
@travisghansen
Copy link
Author

Any feedback on this one?

@@ -0,0 +1,11 @@
module.exports = {
printWidth: 80,
trailingComma: 'es5',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the trailing comma? Nothing wrong about it, I just don't like it 🙈

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, however the default of prettier is actually more inclusive than even that value (adds them more places). Combined with the fact that prettier is moving towards fewer options and just trying to be the standard without really any tweaks it pushes us further from that.

In the end I don’t really care personally, as long as we have something that auto formats :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants