--- a/src/pyams_notify_ws/notify.py Thu Jun 01 16:45:38 2017 +0200
+++ b/src/pyams_notify_ws/notify.py Wed Jul 12 12:14:20 2017 +0200
@@ -61,8 +61,10 @@
action = message.get('action')
if action == 'notify':
# dispatch notification to subscribers
- json_message = json.dumps(message)
- target = message.get('target').get('principals', ())
+ target = message.get('target', {}).get('principals', ())
+ clean_message = message.copy()
+ clean_message.pop('target')
+ json_message = json.dumps(clean_message)
for connection, subscription in users.items():
if subscription.filter_target(target):
yield from connection.send(json_message)