From feac93fd24c0ebef8fa32370f3a82699db60896b Mon Sep 17 00:00:00 2001 From: chris meyers Date: Fri, 24 Jan 2020 10:53:41 -0500 Subject: [PATCH] add websocket group unsubscribe reply * This change adds more than just an unsubscribe reply. * Websockets canrequest to join/leave groups. They do so using a single idempotent request. This change replies to group requests over the websockets with the diff of the group subscription. i.e. what groups the user currenntly is in, what groups were left, and what groups were joined. --- awx/main/consumers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/awx/main/consumers.py b/awx/main/consumers.py index aaa4b1f5b1..e11a20bc99 100644 --- a/awx/main/consumers.py +++ b/awx/main/consumers.py @@ -204,6 +204,11 @@ class EventConsumer(AsyncJsonWebsocketConsumer): ) logger.debug(f"Channel {self.channel_name} left groups {old_groups} and joined {new_groups_exclusive}") self.scope['session']['groups'] = new_groups + await self.send_json({ + "groups_current": list(new_groups), + "groups_left": list(old_groups), + "groups_joined": list(new_groups_exclusive) + }) async def internal_message(self, event): await self.send(event['text'])