This commit is contained in:
AdrienLSH
2024-05-14 08:50:37 +02:00
parent 95f0097ce5
commit e308e8f012
231 changed files with 70 additions and 22 deletions

View File

@ -0,0 +1,16 @@
from channels.generic.websocket import WebsocketConsumer
from django.contrib.auth.models import User
import json
class AbstractRoomMember:
def __init__(self, user: User, socket: WebsocketConsumer):
self.user: User = user
self.socket: WebsocketConsumer = socket
def send(self, detail: str, data: dict = {}) -> None:
raw_data: dict = {"detail": detail}
raw_data.update(data)
self.socket.send(text_data=json.dumps(raw_data))