Commit 9a4f70de authored by Stu Fisher's avatar Stu Fisher

make sure clients exists on server

parent 5b76568b
......@@ -93,13 +93,14 @@ class BVWebserver:
def send_to_all(self, message):
to_rem = []
for key, client in self.server.clients.items():
try:
client.ws.send(message)
if hasattr(self.server, 'clients'):
for key, client in self.server.clients.items():
try:
client.ws.send(message)
except WebSocketError as e:
print('Websocket dead')
to_rem.append(key)
except WebSocketError as e:
print('Websocket dead')
to_rem.append(key)
for key in to_rem:
del self.server.clients[key]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment