feat: 消息回调
This commit is contained in:
@@ -11,7 +11,9 @@ async def ws_handler(websocket, path=None):
|
||||
try:
|
||||
async for message in websocket:
|
||||
print(f"收到前端消息: {message}")
|
||||
await broadcast_message(f"回送消息:{message}") # 发送回客户端的消息
|
||||
# await broadcast_message(f"回送消息:{message}") # 发送回客户端的消息
|
||||
await broadcast_message(f"{message}") # 发送回客户端的消息
|
||||
|
||||
except websockets.exceptions.ConnectionClosed as e:
|
||||
print(f"连接关闭: {e}")
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user