Watchtower Documentation
Multiplayer infrastructure in one line. Your architecture.
Watchtower gives you the infrastructure — connections, rooms, and real-time messaging. You build the game logic. No server to deploy, no WebSocket code to write.
Quick Example
import { connect } from '@watchtower-sdk/core'
// Connect to a room
const room = await connect('my-room')
// Send to everyone
room.broadcast({ x: 100, y: 200 })
// Receive messages
room.on('message', (from, data) => {
console.log(from, data)
})What You Get
Multiplayer Rooms
Create and join rooms with shareable codes. Auto-reconnect, player tracking, host assignment. Just connect() and go.
Messaging
Broadcast to everyone or send to specific players. Every message includes server timestamps for ordering and interpolation.
Global Infrastructure
Runs on Cloudflare's edge network. Zero servers to manage. Auto-scales with your player count. Fast connections worldwide.
What You Build
You decide how to structure your game:
- State sync — How and what to send between players
- Interpolation — How to smooth movement (we provide timestamps)
- Game logic — Rules, physics, win conditions
See Game Patterns for common approaches.
Getting Started
- Install the SDK — npm or CDN
- Quick Start — Your first multiplayer connection
- Game Patterns — Pick a pattern for your game type
API Reference
- SDK Reference — Complete JavaScript/TypeScript API
- REST API — HTTP endpoints
- WebSocket Protocol — Low-level protocol details