delete websocket in coins(не работает нихуя)
This commit is contained in:
@ -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}
|
||||
Reference in New Issue
Block a user