Initial commit from agent

This commit is contained in:
2026-03-24 00:11:34 -05:00
commit 0c777488d3
69 changed files with 4253 additions and 0 deletions

24
core/websocket_manager.py Normal file
View File

@@ -0,0 +1,24 @@
"""
WebSocket connection manager — handles multiple simultaneous clients.
"""
from fastapi import WebSocket
from typing import List
class ConnectionManager:
def __init__(self):
self.active_connections: List[WebSocket] = []
async def connect(self, websocket: WebSocket):
await websocket.accept()
self.active_connections.append(websocket)
def disconnect(self, websocket: WebSocket):
self.active_connections.remove(websocket)
async def broadcast_json(self, data: dict):
for connection in self.active_connections:
await connection.send_json(data)
async def broadcast_bytes(self, data: bytes):
for connection in self.active_connections:
await connection.send_bytes(data)