couchpad docs
couchpad turns phones into game controllers for a TV or web game. Players scan a QR code, the phone page joins a room, and input reaches the TV over a WebRTC DataChannel or, when the network blocks that, a WebSocket relay. These docs cover the whole path, from your first input frame to running your own server.
Start here
- 1InstallAdd couchpad from GitHub
- 2HostCreate a room on the TV
- 3PhoneJoin and draw controls
- 4First inputSee frames arrive
The whole path takes about five minutes with the example server.
Explore
Getting startedA step-by-step tutorial: install, run a server, create a room, join from a phone.ConceptsSignaling, the two DataChannels, relay fallback, chunking, rejoin and resume.Paddle game guideA complete two-player game in about 50 lines of TypeScript.Deploy the serverRun the signaling server on Node, and notes for Cloudflare and AWS.Debugging connectionsWhat to check when WebRTC fails, and how to force the relay.API referenceEvery export with its signature, parameters, return value and an example.WidgetsJoystick, buttons, tilt, swipe, draw, vote and text, with theming.ProtocolEvery message between phone, server and TV, if you write your own server.Error codesWhat each rejection and server error means, and what to do about it.
What couchpad does for you
| You write | couchpad handles |
|---|---|
| A TV page that creates a room and reads input | Room codes, WebRTC offers and answers, ICE candidates |
| A phone page that renders controls | Touch widgets with haptics and accessible roles |
| A WebSocket server (or the example one) | Relay fallback, 28 KB chunking, reconnect with backoff |
| Game logic | Rejoin tokens, TV resume, held-button keepalive, stale frame dropping |