Skip to content

Commit

Permalink
[3.7] A Couple of Documentation Improvements (#4285) (#4288)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1ead89b)

Co-authored-by: Tim Martin <[email protected]>
  • Loading branch information
asvetlov and t-mart authored Oct 28, 2019
1 parent e246e1c commit 7bc5c49
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 @@ -163,8 +163,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 @@ -850,6 +850,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 7bc5c49

Please sign in to comment.