mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Make sure clients are authenticated before sending messages.
As the system is asynchronous some messages could (?) slip through before the socket is closed when auth fails.
This commit is contained in:
@ -12,6 +12,7 @@ class WebSocketHelper:
|
||||
self.clients.add(client)
|
||||
|
||||
def send_message(self, client, event_type, data):
|
||||
if client.check_auth():
|
||||
message = str(json.dumps({'event': event_type, 'data': data}))
|
||||
client.write_message(message)
|
||||
|
||||
|
Reference in New Issue
Block a user