fester/backend/api/ws.py

26 lines
801 B
Python

"""
WebSocketStream — legacy bridge between the EventBus and WebSocket clients.
NOTE: The real broadcasting is now done in backend/main.py via
`_ws_broadcast` which properly awaits the async send. This class is kept
for backward compatibility with the api.py facade, but its `attach_bus`
method is a no-op (the actual wiring happens in main.py).
"""
from backend.events.bus import EventBus
import json
class WebSocketStream:
def __init__(self):
self.clients = [] # shared with main.py's hub.clients
def attach_bus(self, bus: EventBus):
"""No-op — broadcasting is wired in backend/main.py via _ws_broadcast.
Kept for backward compat with api.py's attach_ws_stream()."""
pass
def register_client(self, client):
self.clients.append(client)