Files
posefit-server/app/signaling/websocket_server.py
T
wsy182 c8fd057129 Centralize configuration into config.yaml
- All settings moved to config.yaml
- configs/load.py reads from config.yaml with env var overrides
- Environment variables still work for backward compatibility
- Added pyyaml to requirements
2026-06-10 10:19:41 +08:00

27 lines
658 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 WS_HOST, WS_MAX_SIZE, WS_PORT
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():
logger.info(f"WebRTC signaling server: ws://{WS_HOST}:{WS_PORT}")
async with websockets.serve(handle_client, WS_HOST, WS_PORT, max_size=WS_MAX_SIZE):
await asyncio.Future()