--- a/src/pyams_notify_ws/notify.py Wed Jun 26 18:58:19 2019 +0200
+++ b/src/pyams_notify_ws/notify.py Wed Jun 26 18:58:58 2019 +0200
@@ -55,6 +55,7 @@
action = message.get('action')
if action == 'notify':
# dispatch notification to subscribers
+ host = message.get('host')
source = message.get('source', {}).get('id')
target = message.get('target', {}).get('principals', ())
clean_message = message.copy()
@@ -62,6 +63,9 @@
json_message = json.dumps(clean_message)
async with users_lock:
for connection, subscription in users.items():
+ # don't send notification to other hosts
+ if host and (host != subscription.host):
+ continue
# don't send notification to emitter
if source and (source == subscription.principal['id']):
continue