Some checks failed
CI / lint (pull_request) Successful in 33s
CI / typecheck (pull_request) Failing after 1m42s
CI / test (pull_request) Failing after 2m33s
CI / security (pull_request) Failing after 39s
CI / gitleaks (pull_request) Successful in 36s
CI / commitlint (pull_request) Failing after 10s
31 lines
824 B
Python
31 lines
824 B
Python
"""Pry — Untagged router (remaining api.py routes).
|
|
|
|
Auto-extracted from api.py during the router-split refactor.
|
|
"""
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
# Copyright (c) 2026 Rug Munch Media LLC
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
from fastapi import APIRouter, WebSocket, WebSocketDisconnect
|
|
|
|
from pryextras import streams
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
router = APIRouter(tags=["Untagged"])
|
|
|
|
|
|
@router.websocket("/v1/stream/{job_id}")
|
|
async def stream_endpoint(websocket: WebSocket, job_id: str = "live") -> None:
|
|
await websocket.accept()
|
|
streams.register(job_id, websocket)
|
|
try:
|
|
while True:
|
|
data = await websocket.receive_text()
|
|
await streams.broadcast(job_id, {"echo": data})
|
|
except WebSocketDisconnect:
|
|
streams.unregister(job_id, websocket)
|