Compare commits

...

2 Commits

Author SHA1 Message Date
Kilton937342 fbcb941eae test 2022-07-28 12:07:13 +02:00
Kilton937342 634a2b73e4 consumer original 2022-07-28 11:24:34 +02:00
1 changed files with 6 additions and 4 deletions

View File

@ -19,11 +19,12 @@ class RoomConsumer(AsyncWebsocketConsumer):
self.user = None
try:
self.room = await self.get_room()
print('ACCEPTED')
await self.accept()
await self.send(json.dumps({'type': 'connect', "clientId": self.clientId}))
except:
print('test')
print('REJECTED')
await self.close()
async def receive(self, text_data):
@ -178,7 +179,7 @@ class RoomConsumer(AsyncWebsocketConsumer):
elif type == "reconnect":
client = text_data_json['data']['clientId']
print(not self.scope['user'].is_anonymous, "USERED", self.scope['user'])
if not self.scope['user'].is_anonymous:
userInRoom = await self.userInRoom()
if not userInRoom:
@ -205,7 +206,8 @@ class RoomConsumer(AsyncWebsocketConsumer):
else:
participants = await self.get_participants()
print(client in list(
map(lambda p: p['clientId'], participants)), client, list(map(lambda p: p['clientId'], participants)))
if client in list(map(lambda p: p['clientId'], participants)):
self.clientId = client