Closed ChrisNi888 closed 2 months ago
I think I find it.
If I write it directly in the app's path, like this:
@app.websocket("/chat_room")
the result is normal.
If I create a router, like this:
router = APIRouter(
prefix="/ws",
tags=["WebSocket"],
)
@router.websocket("/chat_room")
the problem mentioned above will occur. The reason is unclear. Maybe there is something I don't know about Fastapi.
close
I tried to use the sample code in FastAPI, and I can receive client information, but I can't send the received information back. I'm using Redis, and I've checked the Redis logs, and the subscription and publication are normal. I think the problem might be that the broadcast is not correctly subscribed to or read. Does anyone know what the problem is?
If I use redis only, it works well.