Изменил вебсокет

This commit is contained in:
urec56 2024-02-11 22:46:11 +03:00
parent a2e34ee619
commit f7e3b333ba

View file

@ -24,7 +24,7 @@ class ConnectionManager(WebSocket):
async def broadcast(self, user_id: int, chat_id: int, message: str):
await self.add_message_to_database(user_id=user_id, chat_id=chat_id, message=message)
for websocket in self.active_connections[chat_id]:
await websocket.send_text(message)
await websocket.send_text(f'{"message": {message}}')
@staticmethod
async def add_message_to_database(user_id: int, chat_id: int, message: str):