Calls and media
Voice rooms, one picture per listener, calls between two people, and the one port that carries them.
How a call travels
Chat and call setup go over the live socket, through the tunnel or your proxy. Call audio and video do not fit through the tunnel, so they go straight to the server on one port number: UDP first, and TCP on the same number for networks that block UDP.
The server is a selective forwarding unit. It passes each person’s Opus audio and H.264 video on to the others and never re-encodes them. Nothing is recorded or stored. Calls live in memory, so a restart ends them and the apps rejoin.
Open the media port
- Set
TINYSERVER_PUBLIC_IPin the environment file to the address members reach: the router’s public IPv4 address. The server does not guess it. TINYSERVER_MEDIA_PORTis 50000 unless set. Compose publishes the same number inside and out, on UDP and TCP.- On the router, forward that port to the host, both UDP and TCP.
- On the host firewall, allow it for both. With the default port and ufw:
ufw allow 50000/udpandufw allow 50000/tcp. - Optional: set
TINYSERVER_LAN_IPto the host’s address on the home network, such as192.168.1.20. Many routers do not let a member at home reach the public address from inside; with this set, the server offers them the LAN address too. docker compose up -d, then open/healthon the chat hostname. It says"media": "up"and lists"transports": ["udp", "tcp"], with"lan"when step 5 is set.
Without TINYSERVER_PUBLIC_IP the server still runs. /health says "media": "off", and a call has no audio or video.
Members see the host’s address. Every member in a call is sent TINYSERVER_PUBLIC_IP. The tunnel does not hide the host’s address from members. Members do not learn each other’s addresses from the server.
A stranger who finds the port gets a reply to a connectivity check and nothing else: no media is processed without the per-join password, which travels only over the signed-in live socket.
What is not built
- No relay. There is no TURN server and no relay mode yet. A host that cannot open a port, such as one behind carrier-grade NAT, cannot carry calls today.
- No IPv6 for media.
TINYSERVER_PUBLIC_IPis an IPv4 address. - A member on a network that allows only port 443 cannot reach the media port.
Upload budget
Set TINYSERVER_MEDIA_EGRESS_KBPS to what the host can upload for calls, in kb/s, such as 8000 on a 10 Mb/s line. The server plans every call together to fit it: screen shares first, then everyone gets the high camera layer if that fits, else the low one, else audio only.
Each listener with a camera to watch costs about 1,200 kb/s on the high layer and 350 on the low one, and each voice about 50. Without a budget, nothing stops a large room sending more than the line carries, and everyone’s audio suffers along with the video.
On a VPS
A small VPS drops call packets long before its CPU is busy, because the kernel’s socket buffer limits are low. The media socket asks for 4 MiB of buffer each way, and a stock Linux kernel silently caps that at about 200 KiB. These are host settings; a container cannot change them. On the host:
printf 'net.core.rmem_max=4194304\nnet.core.wmem_max=4194304\n' | sudo tee /etc/sysctl.d/90-tinyserver-media.conf
sudo sysctl --systemRestart tinyserver afterwards. Its log says media socket buffers with what it got; Linux reports double the usable size, so about 8388608 each way means the setting took.
Set the upload budget a little under what the plan really sustains, not its burst figure.
Once a minute during a call the log has a media counters line:
| Field | What it tells you |
|---|---|
send_dropped | Above zero: the host could not keep up |
longest_turn_ms | Above about 20: the media thread was short of CPU |
longest_gap_ms | Well over 50: the thread, or the whole VM, was not running |
audio_late_ms | How late audio reached the server. It measures the path to the server, not the server. |
tcp_sent | Above zero: someone’s media is on TCP |
TCP streams are capped at 256 in all and 16 from one address. One that sends nothing for a call within 5 seconds, or nothing at all for 30, is closed.
Voice rooms
A room is a voice channel people drop into; nobody is rung. A person is in one call at a time, and joining another leaves the first.
| Setting | Range | Notes |
|---|---|---|
| User limit | 0 to 99 | 0 means the server’s limit for a room |
| Bitrate | 16 to 128 kb/s, 64 unless set | What each app encodes its voice at |
| Push to talk only | on or off | Kept by the server and honoured by the app; the server does not check it |
| Video | on or off | The same: honoured by the app |
| Require end-to-end encryption | on or off | The server refuses an app that cannot. End-to-end encryption. |
How many people a room and a server hold is set by the operator: TINYSERVER_CALL_ROOM_MAX, 12 unless set, and TINYSERVER_CALL_SERVER_MAX, 32 unless set. Size them to what the host and its line carry. A room’s own user limit can lower its number and never raises it past the server’s.
Room permissions decide who may join and who may speak. Someone without the speak permission joins and listens; their audio is not forwarded. Moderators can server mute, server deafen, move and disconnect people. A timeout or a ban ends the person’s call.
A dropped connection keeps its seat for 10 seconds. After 15 seconds with no media at all, the server ends that person’s seat.
One picture
Each listener gets everyone else’s audio and at most one video: the room’s screen share while someone else is sharing, otherwise one camera, the active speaker’s when it is live. A listener is never sent their own picture.
- One screen share per room. The first to start holds it; a second person is told the share is taken. A moderator can end it.
- Cameras send two sizes, 1280×720 and 640×360. The server picks one per listener from that listener’s connection, their own quality choice, and the upload budget.
- Which systems can send a camera or a screen share depends on the app, not the server. Join and use a server lists them.
Calls between two people
A member can call another from their direct conversation. It rings for 30 seconds. Only the two people see it, and it ends for both when one leaves. The conversation keeps whether the call was missed, declined, cancelled or ended, with no duration. A room’s encryption setting does not apply: the call is end-to-end encrypted when both apps can.
There are no group calls outside rooms.