Imported from styly-dev/STYLY-NetSync (
STYLY-NetSync-Server/AGENTS.md). Install upstream withnpx skills add styly-dev/STYLY-NetSync --skill STYLY-NetSync-Server. Copyright stays with the author.
STYLY-NetSync Server
Repository Structure
- Source:
src/styly_netsync/ - Tests:
tests/(unit + integration) - Config:
pyproject.toml,default.toml
Repository Context
- Also check
../AGENTS.mdand../STYLY-NetSync-Unity/. - Keep Python/Unity behavior aligned for networking, protocol, RPC, Network Variable, discovery, and connection changes.
Development Commands
# Setup
pip install -e ".[dev]"
# Run server
styly-netsync-server
styly-netsync-server --control-port 5555 --transform-port 5557 --pub-port 5556 --server-discovery-port 49999
styly-netsync-server --config my-config.toml
# Quality pipeline (run before committing)
black src/ tests/ && ruff check src/ tests/ && mypy src/ && pytest --cov=src
# Load testing
styly-netsync-simulator --clients 100 --server localhost --room default_room
Architecture
- NetSyncServer (
server.py): Multi-threaded (receive, periodic, discovery threads) - BinarySerializer (
binary_serializer.py): Protocol v8 binary serializer - Python Client API (
client.py):net_sync_managerclass for Python clients - REST Bridge (
rest_bridge.py): FastAPI REST API for external integrations
Configuration
default.tomlcontains all settings with defaults- Priority: CLI args > user config (
--config) > default config - REST API:
--rest-api-port(default: 8800)
Entry Points
styly-netsync-server— CLI viacli.pystyly-netsync-simulator— CLI viaclient_simulator.pypython -m styly_netsync— module execution
Development Standards
- Python 3.11+ required; type hints required for all functions (MyPy strict)
- Black (88 chars), Ruff, MyPy;
snake_casemodules/functions,PascalCaseclasses - Test files named
test_*.py; keep deterministic and independent; prefer branch coverage