Use ServerUplinkConnetor.broadcast() instead of local helper

This commit is contained in:
Kristóf Tóth 2018-07-12 14:58:31 +02:00
parent 381cd2b11e
commit 558e660268

View File

@ -131,16 +131,9 @@ class BroadcastingEventHandler(EventHandlerBase, ABC):
response = self.dispatch_handling(message) response = self.dispatch_handling(message)
if response: if response:
self.own_message_hashes.append(self.hash_message(response)) self.own_message_hashes.append(self.hash_message(response))
self.server_connector.send(self.make_broadcast_message(response)) self.server_connector.broadcast(response)
@staticmethod @staticmethod
def hash_message(message): def hash_message(message):
message_bytes = dumps(message, sort_keys=True).encode() message_bytes = dumps(message, sort_keys=True).encode()
return md5(message_bytes).hexdigest() return md5(message_bytes).hexdigest()
@staticmethod
def make_broadcast_message(message):
return {
'key': 'broadcast',
'data': message
}