feat(api): add backend

routes and WebSockets
This commit is contained in:
2025-12-26 18:19:06 +03:00
parent cfec8d0ff6
commit 1b864228d4
28 changed files with 631 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
from fastapi import APIRouter, WebSocket
from starlette.websockets import WebSocketDisconnect
from app.ws.manager import manager
router = APIRouter()
@router.websocket("/ws/live")
async def ws_live(ws: WebSocket) -> None:
await manager.connect(ws)
try:
# Держим соединение
while True:
await ws.receive_text()
except WebSocketDisconnect:
await manager.disconnect(ws)
except Exception:
await manager.disconnect(ws)