Skip to content

Self-hosting

Self-hosting

Run the open-source SyncVerse server yourself and point the Unity SDK at it.

Run the server

The server is a Node.js 18+ process (TypeScript, MIT license). One process serves the lobby on /master and rooms on /rooms/<id>.

Shell
git clone https://github.com/simple-yet-efficient/syncverse-server
cd syncverse-server
npm install          # uWebSockets.js is downloaded from GitHub
npm run build
PORT=9000 PUBLIC_URL=ws://localhost:9000 npm start
The syncverse-server repository is private for now, so the clone needs access: ask Simple Yet Efficient for it. The same applies to the CONTRACT.md link under Protocol.

Check it with GET /health, which returns JSON with the room and player counts. GET /metrics serves the same numbers in Prometheus text format.

Point Unity at it

In the SyncVerseSettings asset set Mode to Self-hosted and Server URL to your server, or call master.Connect("ws://localhost:9000"). The App ID and tokens are ignored by a self-hosted server.

Settings

Everything is optional and read from the environment (or a .env file).

VariableDefaultMeaning
PORT9000Listen port
BIND_HOST0.0.0.0Interface to bind
PUBLIC_URLws://localhost:<PORT>Base URL clients use; room URLs are built from it
MAX_PAYLOAD65536Largest frame in bytes
MAX_ROOMS1000Rooms on this server; CreateRoom answers ServerFull beyond
MAX_PLAYERS_PER_ROOM64Cap on the requested maxPlayers
EMPTY_ROOM_TTL_MS30000An empty room is removed after this long
BUFFER_LOG_LIMIT1000Buffered spawns and RPCs kept per room
MAX_FRAMES_PER_SEC0Frames per second per room socket; 0 means no limit
TRUST_PROXYfalseTake the client IP from X-Forwarded-For

TLS with a reverse proxy

The server speaks plain ws://. Put a reverse proxy in front for wss://, which WebGL builds on https pages and mobile platforms need. With Caddy, certificates are automatic:

Caddyfile
game.example.com {
    reverse_proxy localhost:9000
}

Then set PUBLIC_URL=wss://game.example.com and TRUST_PROXY=true, and use wss://game.example.com in Unity.

Without TLS

Plain ws:// works in the editor and desktop builds. Android needs cleartext traffic allowed and iOS needs an App Transport Security exception, so use TLS for anything you ship.

Same code as the cloud

SyncVerse Cloud runs this server on its game nodes, with the lobby on separate gateways. Self-hosting gives you one process with everything in it; see Introduction for what the cloud adds.