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:
parent
9c62099f32
commit
37597f920f
@ -12,8 +12,9 @@ class WebSocketHelper:
|
||||
self.clients.add(client)
|
||||
|
||||
def send_message(self, client, event_type, data):
|
||||
message = str(json.dumps({'event': event_type, 'data': data}))
|
||||
client.write_message(message)
|
||||
if client.check_auth():
|
||||
message = str(json.dumps({'event': event_type, 'data': data}))
|
||||
client.write_message(message)
|
||||
|
||||
def broadcast(self, event_type, data):
|
||||
console.debug('Sending: ' + str(json.dumps({'event': event_type, 'data': data})))
|
||||
|
Loading…
Reference in New Issue
Block a user