Compare commits

...

2 Commits

Author SHA1 Message Date
38d9e87393 Test threading lock 2025-02-12 11:11:58 +01:00
48791ee1f1 add output 2025-02-12 11:11:29 +01:00

View File

@ -18,7 +18,6 @@ with open(r'/etc/tellme/hooks.yml') as hooksfile:
def sendmessage(target, message):
print("Sendmessage %s called to %s" % (message, target))
with lock:
msg = ("%s %s" % (target, message))
# Create a unique correlation ID
@ -33,6 +32,7 @@ def sendmessage(target, message):
ws = websocket.create_connection(uri) # Blocking WebSocket connection
ws.send(json_command) # Send message to WebSocket
response = ws.recv() # Receive response
print("Message %s sent over websocket to %s" % (message, target))
# ws.close() # Close WebSocket connection
# print(response)
ws.close()
@ -52,6 +52,7 @@ def webhook_receiver(id):
if target is not None:
print(target)
with lock:
sendmessage(target, data.get('message'))
else:
print("No target found, dropping message")