You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found your great tutorial article! Here is a comment in chat logic on line 27
for _ws in self.request.app['websockets']:
_ws.send_str('%s joined' % login)
I do wonder why await is not required for _ws.send_str() here?
Why don't we use asyncio.create_task(_ws.send_str()) ? My expectation is that without asyncio.create_task we are chaining send operations sequentially and if one of the browser's websockets is not reading (server's TCP socket's send buffer is full) chat logic will grind to halt. If we apply asyncio.create_task each send_str() call would be independent and can be stuck on send_str(), all pending send_str() calls would be cleaned when failed ping-pong of that websocket destroys connection.
Thanks for great article,
Alex
The text was updated successfully, but these errors were encountered:
Hi,
Found your great tutorial article! Here is a comment in chat logic on line 27
I do wonder why
await
is not required for_ws.send_str()
here?Why don't we use
asyncio.create_task(_ws.send_str())
? My expectation is that withoutasyncio.create_task
we are chaining send operations sequentially and if one of the browser's websockets is not reading (server's TCP socket's send buffer is full) chat logic will grind to halt. If we applyasyncio.create_task
eachsend_str()
call would be independent and can be stuck onsend_str()
, all pendingsend_str()
calls would be cleaned when failed ping-pong of that websocket destroys connection.Thanks for great article,
Alex
The text was updated successfully, but these errors were encountered: