fix: roomconsumer bug修改
This commit is contained in:
parent
df6fbf500e
commit
46d127758a
|
@ -31,8 +31,10 @@ 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 text_data:
|
||||||
|
content = json.loads(text_data)
|
||||||
if content['type'] == 'chat':
|
if content['type'] == 'chat':
|
||||||
content['from'] = sender_user.username
|
content['from'] = sender_user.username
|
||||||
await self.channel_layer.group_send(
|
await self.channel_layer.group_send(
|
||||||
|
|
Loading…
Reference in New Issue