// DOCUMENTATION

STUN / TURN Servers

Musicbox streams between your devices over a direct peer-to-peer connection. To set that up, WebRTC needs ICE servers: a STUN server helps each device discover how it looks from the public internet, and a TURN server relays the audio in the rarer case where a direct link can't be made. Premium accounts get these out of the box; on the free tier you can supply your own.

STUN — free and enough for most setups

STUN servers are lightweight and there are well-known free ones you can use immediately. For most home and mobile networks, STUN alone is all Musicbox needs to connect. Paste a list like this into Settings → Integrations → ICE servers as JSON:

[
  { "urls": "stun:stun.l.google.com:19302" }
]

TURN — only when a direct link fails

Some strict or corporate networks block direct connections, and then a TURN relay is required. TURN uses more bandwidth, so it's used only as a fallback. You have free options here too:

  • Free TURN providers — several services offer a free TURN tier that's fine for personal use. They give you a host, username, and credential to drop into the list below.
  • Self-host — running coturn on a small VPS gives you your own TURN server for the cost of the server.

A list with both STUN and a TURN server looks like this:

[
  { "urls": "stun:stun.l.google.com:19302" },
  {
    "urls": "turn:your-turn-host:3478",
    "username": "your-username",
    "credential": "your-credential"
  }
]

Good to know

  • The field takes a JSON array of RTCIceServer objects — the same shape shown above. If the JSON is invalid, Musicbox falls back to a public STUN server so playback still works.
  • Start with just STUN. Only add TURN if two of your devices refuse to connect on the network you're using.
  • TURN credentials let others relay through your server, so keep them private.