This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from asgiref.sync import async_to_sync | |
| from channels.generic.websocket import WebsocketConsumer | |
| import json | |
| class ChatConsumer(WebsocketConsumer): | |
| active_rooms = {} | |
| def connect(self): | |
| self.room_name = self.scope["url_route"]["kwargs"]["room_name"] | |
| self.room_group_name = f"chat_{self.room_name}" |