f9384f7bc1
- ServerConfig, VideoConfig, ModelConfig, DeadBugConfig, AudioConfig, LoggingConfig as nested dataclasses - Consumers use config.server.host, config.model.resolved_path etc. - env var overrides preserved via _apply_env_overrides()
28 lines
667 B
Python
28 lines
667 B
Python
from __future__ import annotations
|
|
|
|
import asyncio
|
|
import json
|
|
|
|
import websockets
|
|
from loguru import logger
|
|
|
|
from app.webrtc.peer_session import PeerSession
|
|
from configs.load import config
|
|
|
|
|
|
async def handle_client(websocket):
|
|
client = websocket.remote_address
|
|
logger.info(f"Client connected: {client}")
|
|
|
|
session = PeerSession()
|
|
await session.handle(websocket)
|
|
|
|
logger.info(f"Connection closed: {client}")
|
|
|
|
|
|
async def main():
|
|
cfg = config.server
|
|
logger.info(f"WebRTC signaling server: ws://{cfg.host}:{cfg.port}")
|
|
async with websockets.serve(handle_client, cfg.host, cfg.port, max_size=cfg.max_ws_size):
|
|
await asyncio.Future()
|