# fast-signal **Repository Path**: ghostroot/fast-signal ## Basic Information - **Project Name**: fast-signal - **Description**: No description available - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-12 - **Last Updated**: 2026-05-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Fast-Signal WebRTC信令服务器 高性能WebRTC信令服务器,基于Python FastAPI构建,提供稳定、可靠的实时音视频通信信令服务。 ## 特性 - **高性能**: 基于FastAPI + asyncio,支持高并发WebSocket连接 - **实时通信**: WebSocket双向通信,支持offer/answer/ICE信令交换 - **会议室管理**: 支持多会议室同时运行,每个会议室可容纳多个用户 - **消息定向转发**: WebRTC信令消息和通用消息均支持定向发送 - **自动资源管理**: 定期清理空会议室,释放系统资源 - **完整测试**: 49个测试用例覆盖接口、功能、边界和压力测试 ## 技术栈 - Python 3.14+ - FastAPI 0.115+ - WebSocket (websockets) - Uvicorn - pytest / pytest-asyncio ## 快速开始 ### 安装 ```bash git clone https://gitee.com/ghostroot/fast-signal.git cd fast-signal uv sync ``` ### 运行服务器 ```bash python run.py ``` 服务器默认运行在 `http://localhost:8000` ### 运行测试 ```bash python tests/test_comprehensive_server.py ``` ## WebSocket连接 ``` ws://localhost:8000/ws/{room_id}/{user_id}?name={user_name} ``` ## 消息格式 所有消息均为JSON格式。 ### 用户加入确认 ```json { "type": "user_joined", "user_id": "user123", "user_name": "张三", "success": true, "other_users": [] } ``` ### 发送Offer ```json { "type": "offer", "target_id": "user456", "sdp": "v=0\r\no=- ..." } ``` ### 发送Answer ```json { "type": "answer", "target_id": "user123", "sdp": "v=0\r\no=- ..." } ``` ### ICE候选者 ```json { "type": "ice_candidate", "target_id": "user456", "candidate": "candidate:1 1 UDP ..." } ``` ### 通用消息 ```json { "type": "message", "target_id": "user456", "payload": {"content": "hello"} } ``` ## 环境变量 | 变量 | 默认值 | 说明 | |------|--------|------| | PORT | 8000 | 服务器端口 | | HOST | 0.0.0.0 | 服务器地址 | | LOG_LEVEL | INFO | 日志级别 | ## 项目结构 ``` fast-signal/ ├── src/fast_signal/ │ ├── core/ # 核心模块 │ │ ├── meeting_room.py # 会议室管理 │ │ └── signaling_processor.py # 信令处理 │ ├── utils/ # 工具模块 │ │ ├── logger.py # 日志工具 │ │ ├── ssl_utils.py # SSL工具 │ │ └── platform_utils.py # 平台工具 │ └── main.py # 主程序 ├── tests/ # 测试脚本 │ └── test_comprehensive_server.py ├── docs/ # 文档 ├── static/ # 静态资源 ├── run.py # 启动脚本 └── pyproject.toml # 项目配置 ``` ## 许可证 MIT