-
-
Notifications
You must be signed in to change notification settings - Fork 563
Closed
Description
There is something I don't understand about how to get a response messages, probably due to lack of understanding how asycio works.
Currently I have following code:
async def send_message(conn, message):
await conn.send(payload)
return await conn.recv()
This works fine for one call, but fails for multiple concurrent calls with error:
cannot call recv while another coroutine is already waiting for the next message
I tried using asyncio.wait_for
and asyncio.ensure_future
but it all fails with same error. One request succeeds the rest fail.
What would be the best way to send a message and receive a response?
Any help would be highly appreciated 🙏
Metadata
Metadata
Assignees
Labels
No labels