From 386137c90eaac27d134b0913a9c543f9ab7ffc73 Mon Sep 17 00:00:00 2001 From: matitos Date: Sat, 19 Sep 2026 13:41:55 +0000 Subject: [PATCH] Add a friendly GET /api/ws response A plain browser hit on the socket URL now returns a JSON hint instead of a confusing 404/426. Companion to the Basic-auth bypass on /api/ws. --- backend/app/api/routes.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/app/api/routes.py b/backend/app/api/routes.py index 3dead4d..21967b8 100644 --- a/backend/app/api/routes.py +++ b/backend/app/api/routes.py @@ -191,6 +191,15 @@ async def close_position( return engine.status() +@router.get("/ws") +def websocket_info() -> dict[str, str]: + """A plain browser hit on the socket URL gets a clear hint, not a 404/426.""" + return { + "detail": "This endpoint is a WebSocket. Connect with a WebSocket client.", + "path": "/api/ws", + } + + @router.websocket("/ws") async def websocket_endpoint(websocket: WebSocket) -> None: runtime: Runtime = websocket.app.state.runtime -- 2.54.0