feat: uncomment significant code for ws
This commit is contained in:
@@ -67,27 +67,20 @@ class ChatConsumer(AsyncWebsocketConsumer):
|
||||
|
||||
await self._save_message(user, text)
|
||||
|
||||
# Uz
|
||||
# Bu funksiya ishlatilmayapti, shuning uchun commentga olib qoydim, bu funksiya orniga /core/apps/chat/tasks/message.py ichida rest api yordamida message
|
||||
# yuborilsa ishlatiladigan task bor.
|
||||
|
||||
# En
|
||||
# This function is not used, so I commented it out. Instead, a task is used in /core/apps/chat/tasks/message.py
|
||||
# to send message when message is added from REST API.
|
||||
|
||||
# async def chat_message(self, event):
|
||||
# await self.send(
|
||||
# text_data=json.dumps(
|
||||
# {
|
||||
# "id": event["id"],
|
||||
# "message_type": event["message_type"],
|
||||
# "text": event["text"],
|
||||
# "file_url": event["file_url"],
|
||||
# "sender": event["sender"],
|
||||
# "created_at": event["created_at"],
|
||||
# }
|
||||
# )
|
||||
# )
|
||||
|
||||
async def chat_message(self, event):
|
||||
await self.send(
|
||||
text_data=json.dumps(
|
||||
{
|
||||
"id": event["id"],
|
||||
"message_type": event["message_type"],
|
||||
"text": event["text"],
|
||||
"file_url": event["file_url"],
|
||||
"sender": event["sender"],
|
||||
"created_at": event["created_at"],
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@database_sync_to_async
|
||||
def _save_message(self, user, text):
|
||||
|
||||
Reference in New Issue
Block a user