From e364c7d965b3a0244613e11181485fd3701fd393 Mon Sep 17 00:00:00 2001 From: Guy Van Sanden Date: Wed, 12 Feb 2025 11:41:45 +0100 Subject: [PATCH] Debug --- server/src/tellmesrv.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/server/src/tellmesrv.py b/server/src/tellmesrv.py index 2e1088b..9f56560 100644 --- a/server/src/tellmesrv.py +++ b/server/src/tellmesrv.py @@ -29,12 +29,12 @@ def sendmessage(target, message): json_command = json.dumps(command) """ Connects to WebSocket server, sends a message, and returns the response """ - uri = "ws://localhost:5080" - ws = websocket.create_connection(uri) # Blocking WebSocket connection + # uri = "ws://localhost:5080" + # ws = websocket.create_connection(uri) # Blocking WebSocket connection ws.send(json_command) # Send message to WebSocket responsejson = ws.recv() # Receive response response = json.loads(responsejson) - ws.close() + # ws.close() for chatitem in response['resp']['chatItems']: statusdict = chatitem['chatItem']['meta']['itemStatus'] @@ -49,7 +49,11 @@ def sendmessage(target, message): print("Message '%s' sent over websocket to %s, status was %s" % (smessage, target, status)) if status == 'complete': - return True + if smessage != message: + print("Sent duplicate message, FAIL") + return False + else: + return True else: return False @@ -79,5 +83,5 @@ def webhook_receiver(id): if __name__ == '__main__': print("Started %s" % (versionstring)) uri = "ws://localhost:5080" - # ws = websocket.create_connection(uri) + ws = websocket.create_connection(uri) app.run()