class AbstractRoomMember: def __init__(self, user_id: int, socket: WebsocketConsumer): self.user_id: int = user_id self.socket: WebsocketConsumer = socket def send(self, detail: str, data: dict = {}): raw_data: dict = {"detail": detail} raw_data.update(data) self.socket.send(text_data=json.dumps(raw_data)) def accept(self): self.socket.accept() def disconnect(self): self.socket.disconnect(200)