Last active
January 18, 2021 20:23
-
-
Save lbatteau/d02a0ea8746ca9416286c32e642c9689 to your computer and use it in GitHub Desktop.
subscribe.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async def subscribe(channel: str, redis: Redis) -> AsyncGenerator: | |
(subscription,) = await redis.subscribe(channel=Channel(channel, False)) | |
while await subscription.wait_message(): | |
yield {"event": "message", "data": await subscription.get()} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment