c8fd057129
- 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
27 lines
658 B
Python
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()
|