From fd60f8fcb951b1c924a7006af6f940b61ed61409 Mon Sep 17 00:00:00 2001 From: Jaehun You Date: Thu, 21 Nov 2024 15:30:22 +0900 Subject: [PATCH] Discard channel from group when disconnecting See also: #17 --- wlm_server/operation/consumers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wlm_server/operation/consumers.py b/wlm_server/operation/consumers.py index 5ee4c61..dcbe96d 100644 --- a/wlm_server/operation/consumers.py +++ b/wlm_server/operation/consumers.py @@ -14,3 +14,6 @@ async def connect(self): self.group_name = f'channel_{self.ch}' await self.channel_layer.group_add(self.group_name, self.channel_name) await self.accept() + + async def disconnect(self, code): + await self.channel_layer.group_discard(self.group_name, self.channel_name)