File tree Expand file tree Collapse file tree 3 files changed +3
-3
lines changed
Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Original file line number Diff line number Diff line change 8383
8484Here's a coroutine that broadcasts a message to all clients::
8585
86- from websockets import ConnectionClosed
86+ from websockets.exceptions import ConnectionClosed
8787
8888 async def broadcast(message):
8989 for websocket in CLIENTS.copy():
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ You can run a task in the background to send keepalive messages:
112112 import itertools
113113 import json
114114
115- from websockets import ConnectionClosed
115+ from websockets.exceptions import ConnectionClosed
116116
117117 async def keepalive (websocket , ping_interval = 30 ):
118118 for ping in itertools.count():
Original file line number Diff line number Diff line change 66import sys
77import time
88
9- from websockets import ConnectionClosed
109from websockets .asyncio .server import broadcast , serve
10+ from websockets .exceptions import ConnectionClosed
1111
1212
1313CLIENTS = set ()
You can’t perform that action at this time.
0 commit comments