delete websocket in coins(не работает нихуя)

This commit is contained in:
aurinex
2025-12-29 13:54:51 +05:00
parent 9d007a45c8
commit daa2561b89
6 changed files with 5 additions and 99 deletions

View File

@ -1,25 +0,0 @@
# app/api/coins_ws.py
from fastapi import APIRouter, WebSocket, WebSocketDisconnect, Query
from app.realtime.coins_hub import coins_hub
router = APIRouter(tags=["Coins WS"])
@router.websocket("/ws/coins")
async def coins_ws(
websocket: WebSocket,
username: str = Query(...),
):
await coins_hub.connect(username, websocket)
try:
while True:
await websocket.receive_text() # ping / keep-alive
except WebSocketDisconnect:
pass
finally:
await coins_hub.disconnect(username, websocket)
@router.get("/ws/coins/ping")
async def ping():
return {"ok": True}