Advance don't merge
This commit is contained in:
@ -18,17 +18,25 @@ class ChatConsumer(WebsocketConsumer):
|
||||
text_data_json = json.loads(text_data)
|
||||
message = text_data_json['message']
|
||||
|
||||
user = self.scope["user"]
|
||||
if user.is_anonymous:
|
||||
return;
|
||||
|
||||
async_to_sync(self.channel_layer.group_send)(
|
||||
self.room_group_name,
|
||||
{
|
||||
'type':'chat_message',
|
||||
'username':self.scope["user"].username,
|
||||
'username':user.username,
|
||||
'message':message
|
||||
}
|
||||
)
|
||||
|
||||
def chat_message(self, event):
|
||||
|
||||
user = self.scope["user"]
|
||||
if user.is_anonymous:
|
||||
return;
|
||||
|
||||
self.send(text_data=json.dumps({
|
||||
'type':'chat',
|
||||
'username':event['username'],
|
||||
|
Reference in New Issue
Block a user