This is a tiny WebSocket signaling server for WebRTC. It forwards messages between peers in the same room.
Render can deploy this directly from your GitHub repo as a Web Service. Render supports WebSockets for web services.
If you use a Blueprint, keep render.yaml at the repo root. citeturn0search0turn0search2turn0search3
- Commit these files to the root of your repo.
- In Render: New → Blueprint and point to your repo.
- Set the env var
AUTH_KEYin the Render UI (global gate), and optionallySIGNALING_TOKEN(WebSocket token auth).
- Runtime: Node
- Build command:
npm ci - Start command:
npm start
(These are the standard values Render recommends for Node services. citeturn0search1turn0search5)
Connect:
- Local:
ws://localhost:3000/ws?room=test
- Render (TLS-terminated, so use
wss://):wss://YOUR-SERVICE.onrender.com/ws?room=test
Global auth key (if AUTH_KEY is set)
All endpoints require the query param:
?auth_key=YOUR_AUTH_KEY
Examples:
http://localhost:3000/?auth_key=YOUR_AUTH_KEYwss://YOUR-SERVICE.onrender.com/ws?room=test&auth_key=YOUR_AUTH_KEY
Optional shared token auth
If you set SIGNALING_TOKEN on the server, clients must include:
wss://YOUR-SERVICE.onrender.com/ws?room=test&token=YOUR_TOKEN
Messaging
Anything you send (JSON preferred) is forwarded to other peers in the same room.
Example payloads from a WebRTC client:
{ "type": "offer", "sdp": "..." }
{ "type": "answer", "sdp": "..." }
{ "type": "candidate", "candidate": { "candidate": "...", "sdpMid": "0", "sdpMLineIndex": 0 } }The server will automatically attach:
from: sender socket idroom: room id
Direct messages
If you include "to": "<peerId>", the server will route the message only to that peer (if present).
npm ci
npm startThen open:
http://localhost:3000/?auth_key=YOUR_AUTH_KEY(info)http://localhost:3000/healthz?auth_key=YOUR_AUTH_KEY(health)
- Rooms are kept in-memory. If the process restarts, everyone reconnects.
- Multiple instances won't share room state without a shared pub/sub layer (Redis, etc.).