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 83
83
84
84
Here's a coroutine that broadcasts a message to all clients::
85
85
86
- from websockets import ConnectionClosed
86
+ from websockets.exceptions import ConnectionClosed
87
87
88
88
async def broadcast(message):
89
89
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:
112
112
import itertools
113
113
import json
114
114
115
- from websockets import ConnectionClosed
115
+ from websockets.exceptions import ConnectionClosed
116
116
117
117
async def keepalive (websocket , ping_interval = 30 ):
118
118
for ping in itertools.count():
Original file line number Diff line number Diff line change 6
6
import sys
7
7
import time
8
8
9
- from websockets import ConnectionClosed
10
9
from websockets .asyncio .server import broadcast , serve
10
+ from websockets .exceptions import ConnectionClosed
11
11
12
12
13
13
CLIENTS = set ()
You can’t perform that action at this time.
0 commit comments