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

Async method of SSDPClient.m_search #102

Open
DragonwolfAside opened this issue Jan 13, 2025 · 1 comment
Open

Async method of SSDPClient.m_search #102

DragonwolfAside opened this issue Jan 13, 2025 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@DragonwolfAside
Copy link

Is your feature request related to a problem? Please describe.
Cannot make full use of m_search() in async context.

Describe the solution you'd like
Add a async_m_search() that handles async responses.

Describe alternatives you've considered
Due to [x for x in self.recv()] waits until all responses are collected, I consider:

async def async_m_search(self, st="ssdp:all", mx=1):
    host = "{}:{}".format(self.broadcast_ip, self.port)
    data = create_msearch_payload(host, st, mx)
    self.send(data)
    for response in self.recv():
        try:
            headers = parse_headers(response)
            yield headers
        except ValueError:
            pass

Additional context
None. Thanks.

@DragonwolfAside
Copy link
Author

DragonwolfAside commented Jan 20, 2025

Made an implementation #103

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

No branches or pull requests

2 participants