fix: roomconsumer bug修改
This commit is contained in:
parent
df6fbf500e
commit
46d127758a
|
@ -31,14 +31,16 @@ class RoomConsumer(AsyncWebsocketConsumer):
|
||||||
self.channel_name
|
self.channel_name
|
||||||
)
|
)
|
||||||
|
|
||||||
async def receive_json(self, content, **kwargs):
|
async def receive(self, text_data=None, bytes_data=None):
|
||||||
sender_user = self.scope["user"]
|
sender_user = self.scope["user"]
|
||||||
if content['type'] == 'chat':
|
if text_data:
|
||||||
content['from'] = sender_user.username
|
content = json.loads(text_data)
|
||||||
await self.channel_layer.group_send(
|
if content['type'] == 'chat':
|
||||||
self.room_group_name,
|
content['from'] = sender_user.username
|
||||||
content
|
await self.channel_layer.group_send(
|
||||||
)
|
self.room_group_name,
|
||||||
|
content
|
||||||
|
)
|
||||||
|
|
||||||
async def chat(self, content):
|
async def chat(self, content):
|
||||||
await self.send(json.dumps(content, ensure_ascii=False))
|
await self.send(json.dumps(content, ensure_ascii=False))
|
||||||
|
|
Loading…
Reference in New Issue