Skip to content

Commit 50fa781

Browse files
committed
Fix server websocket example
1 parent 55b7cb0 commit 50fa781

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/web.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ using response's methods:
396396
ws = web.WebSocketResponse()
397397
await ws.prepare(request)
398398
399-
while True:
399+
while not ws.closed:
400400
msg = await ws.receive()
401401
402402
if msg.tp == aiohttp.MsgType.text:
@@ -407,7 +407,7 @@ using response's methods:
407407
elif msg.tp == aiohttp.MsgType.close:
408408
print('websocket connection closed')
409409
elif msg.tp == aiohttp.MsgType.error:
410-
print('ws connection closed with exception %s',
410+
print('ws connection closed with exception %s' %
411411
ws.exception())
412412
413413
return ws

0 commit comments

Comments
 (0)