consumer original
This commit is contained in:
parent
b7cb2627ed
commit
634a2b73e4
@ -22,8 +22,8 @@ class RoomConsumer(AsyncWebsocketConsumer):
|
|||||||
|
|
||||||
await self.accept()
|
await self.accept()
|
||||||
await self.send(json.dumps({'type': 'connect', "clientId": self.clientId}))
|
await self.send(json.dumps({'type': 'connect', "clientId": self.clientId}))
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print('test')
|
|
||||||
await self.close()
|
await self.close()
|
||||||
|
|
||||||
async def receive(self, text_data):
|
async def receive(self, text_data):
|
||||||
@ -178,7 +178,7 @@ class RoomConsumer(AsyncWebsocketConsumer):
|
|||||||
|
|
||||||
elif type == "reconnect":
|
elif type == "reconnect":
|
||||||
client = text_data_json['data']['clientId']
|
client = text_data_json['data']['clientId']
|
||||||
|
print(not self.scope['user'].is_anonymous, "USERED", self.scope['user'])
|
||||||
if not self.scope['user'].is_anonymous:
|
if not self.scope['user'].is_anonymous:
|
||||||
userInRoom = await self.userInRoom()
|
userInRoom = await self.userInRoom()
|
||||||
if not userInRoom:
|
if not userInRoom:
|
||||||
@ -205,7 +205,8 @@ class RoomConsumer(AsyncWebsocketConsumer):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
participants = await self.get_participants()
|
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)):
|
if client in list(map(lambda p: p['clientId'], participants)):
|
||||||
self.clientId = client
|
self.clientId = client
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user