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

How to unsubscribe from discovery? #70

Open
Sawtaytoes opened this issue Nov 23, 2020 · 1 comment
Open

How to unsubscribe from discovery? #70

Sawtaytoes opened this issue Nov 23, 2020 · 1 comment

Comments

@Sawtaytoes
Copy link

When calling wemoClient.discover, how do I unsubscribe?

@jimmywarting
Copy link
Owner

hmm, it currently isn't possible
i could think of a couple of solution to solve this

  • One would be to use AbortSignal/AbortController
  • Another would be to return a stop function
const ctrl = new AbortController()
const {signal} = ctrl
wemoClientDiscover(cb, { signal })

const listener = wemoClientDiscover(cb)
listener.stop()

it would also be cool to do something like

for await (const device of wemoClientDiscover({ signal })) {
  // ...
}

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

No branches or pull requests

2 participants