-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Awaiting on WebSocketResponse.send_* does not work #1645
Comments
I can prepare PR, if someone advises me on how to fix the issue. |
But all websocket write methods are not awaitable since the start. Why to make them awaitable? |
Hm...I guess, documentation need to clarify the moment with "coroutines". /cc @fafhrd91 |
Technically they are not coroutines but they return coroutine object |
@mind1master we need to add empty coroutine and return it instead of |
fixed in 1.3 branch, i will release 1.3.2 later today |
Long story short
In documentation it says:
http://aiohttp.readthedocs.io/en/stable/web_reference.html?highlight=back%20pressure#websocketresponse
However, if I try to do it, I get:
It can be seen, that when writer's buffer is not full,
WebSocketWriter._send_frame
returns a tuple https://github.com/KeepSafe/aiohttp/blob/e49b59b0594ca4c21a3f788ffcbe0005c79daa65/aiohttp/_ws_impl.py#L457 . Maybe it should be async function or return a Future?Expected behaviour
Awaiting on
WebSocketResponse.send_*
should work.Actual behaviour
Awaiting on
WebSocketResponse.send_*
when buffer is not full results inTypeError: object tuple can't be used in 'await' expression
.Steps to reproduce
ws_server.py
ws_client.py
Your environment
aiohttp 1.3.1, Python 3.6, OS 10.12.2
The text was updated successfully, but these errors were encountered: