Skip to content

Commit

Permalink
A Couple of Documentation Improvements (#4285)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-mart authored and asvetlov committed Oct 16, 2020
1 parent 30d1b46 commit a204341
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/4285.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve some code examples in the documentation involving websockets and starting a simple HTTP site with an AppRunner.
4 changes: 2 additions & 2 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ peers. ::

try:
async for msg in channel.iter():
answer = process message(msg)
ws.send_str(answer)
answer = process_the_message(msg) # your function here
await ws.send_str(answer)
finally:
await redis.unsubscribe('channel:1')

Expand Down
3 changes: 3 additions & 0 deletions docs/web_advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,9 @@ The simple startup code for serving HTTP site on ``'localhost'``, port
site = web.TCPSite(runner, 'localhost', 8080)
await site.start()

while True:
await asyncio.sleep(3600) # sleep forever

To stop serving call :meth:`AppRunner.cleanup`::

await runner.cleanup()
Expand Down

0 comments on commit a204341

Please sign in to comment.