fix(chat): 修复多个聊天错误 消息格式错误导致断连、新消息会通知到发件人、加强消息发送的成员验证
This commit is contained in:
@@ -11,6 +11,7 @@ import redis.asyncio as aioredis
|
||||
import ujson
|
||||
from fastapi import WebSocket
|
||||
from fastapi.websockets import WebSocketState
|
||||
from simple_spider_tool import jsonpath
|
||||
|
||||
from core.db.engine import get_cache
|
||||
|
||||
@@ -104,7 +105,9 @@ class SocketManager:
|
||||
if socket.client_state != WebSocketState.CONNECTED:
|
||||
continue
|
||||
data = message['data']
|
||||
await socket.send_text(data)
|
||||
if f',"user_id":{socket.user_id}' in data:
|
||||
continue
|
||||
await socket.send_json(data)
|
||||
else:
|
||||
if self._task_cancel is False:
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user