diff --git a/src/eddn/Gateway.py b/src/eddn/Gateway.py index a5155d7..daaefeb 100644 --- a/src/eddn/Gateway.py +++ b/src/eddn/Gateway.py @@ -135,11 +135,9 @@ def push_message(parsed_message: Dict, topic: str) -> None: # Push a zlib compressed JSON representation of the message to # announcers with schema as topic - compressed_msg = zlib.compress(string_message) + compressed_message = zlib.compress(string_message) - send_message = f"{str(topic)!r} |-| {compressed_msg!r}".encode('utf8') - - sender.send(send_message) + sender.send(compressed_message) stats_collector.tally("outbound") diff --git a/src/eddn/Monitor.py b/src/eddn/Monitor.py index 9b01b49..823b7a8 100644 --- a/src/eddn/Monitor.py +++ b/src/eddn/Monitor.py @@ -210,23 +210,12 @@ class Monitor(Thread): database=Settings.MONITOR_DB['database'] ) - # Separate topic from message - message_split = message.split(b' |-| ') - - # Handle gateway not sending topic - if len(message_split) > 1: - message = message_split[1] - else: - message = message_split[0] - - print(f'message: {message}') message_text = zlib.decompress(message) json = simplejson.loads(message_text) # Default variables schema_id = json['$schemaRef'] - software_id = json['header']['softwareName'].encode('utf8') + ' | ' \ - + json['header']['softwareVersion'].encode('utf8') + software_id = f'{json["header"]["softwareName"]} | {json["header"]["softwareVersion"]}' # Duplicates? if Settings.RELAY_DUPLICATE_MAX_MINUTES: