Skip to content

Commit fce02ab

Browse files
idlesignaaugustin
authored andcommitted
Docs. Correct Producer pattern example.
1 parent 5fa24bb commit fce02ab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/howto/patterns.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ To send messages to the WebSocket connection::
3838
from websockets.exceptions import ConnectionClosed
3939

4040
async def producer_handler(websocket):
41-
try:
42-
while True:
41+
while True:
42+
try:
4343
message = await produce()
4444
await websocket.send(message)
45-
except ConnectionClosed:
46-
break
45+
except ConnectionClosed:
46+
break
4747

4848
In this example, ``produce()`` is a coroutine implementing your business logic
4949
for generating the next message to send on the WebSocket connection.

0 commit comments

Comments
 (0)