Remove timespan

This commit is contained in:
Andros Fenollosa 2020-11-17 21:16:53 +01:00
parent 39964255e8
commit f4feb79981

View File

@ -27,7 +27,6 @@ class ChatConsumer(AsyncWebsocketConsumer):
text_data_json = json.loads(text_data) text_data_json = json.loads(text_data)
name = text_data_json["name"] name = text_data_json["name"]
text = text_data_json["text"] text = text_data_json["text"]
created_at = text_data_json["createdAt"]
# Enviamos el mensaje a la sala # Enviamos el mensaje a la sala
await self.channel_layer.group_send( await self.channel_layer.group_send(
@ -35,16 +34,15 @@ class ChatConsumer(AsyncWebsocketConsumer):
{ {
"type": "chat_message", "type": "chat_message",
"name": name, "name": name,
"text": text, "text": text
"created_at": created_at,
}, },
) )
async def chat_message(self, event): async def chat_message(self, event):
''' Recibimos información de la sala ''' ''' Recibimos información de la sala '''
print(self.channel_layer.group_channels('chat_python'))
name = event["name"] name = event["name"]
text = event["text"] text = event["text"]
created_at = event["created_at"]
# Send message to WebSocket # Send message to WebSocket
await self.send( await self.send(
@ -52,8 +50,7 @@ class ChatConsumer(AsyncWebsocketConsumer):
{ {
"type": "chat_message", "type": "chat_message",
"name": name, "name": name,
"text": text, "text": text
"created_at": created_at
} }
) )
) )