Merge pull request 'feat: uncomment significant code for ws' (#81) from behruz into main
All checks were successful
Deploy to Production / build-and-deploy (push) Successful in 1m55s
All checks were successful
Deploy to Production / build-and-deploy (push) Successful in 1m55s
Reviewed-on: #81
This commit is contained in:
@@ -67,27 +67,20 @@ class ChatConsumer(AsyncWebsocketConsumer):
|
|||||||
|
|
||||||
await self._save_message(user, text)
|
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
|
async def chat_message(self, event):
|
||||||
# yuborilsa ishlatiladigan task bor.
|
await self.send(
|
||||||
|
text_data=json.dumps(
|
||||||
# En
|
{
|
||||||
# This function is not used, so I commented it out. Instead, a task is used in /core/apps/chat/tasks/message.py
|
"id": event["id"],
|
||||||
# to send message when message is added from REST API.
|
"message_type": event["message_type"],
|
||||||
|
"text": event["text"],
|
||||||
# async def chat_message(self, event):
|
"file_url": event["file_url"],
|
||||||
# await self.send(
|
"sender": event["sender"],
|
||||||
# text_data=json.dumps(
|
"created_at": event["created_at"],
|
||||||
# {
|
}
|
||||||
# "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
|
@database_sync_to_async
|
||||||
def _save_message(self, user, text):
|
def _save_message(self, user, text):
|
||||||
|
|||||||
Reference in New Issue
Block a user