Can you make a multiplayer web game without a server?
Updated 2026-11-23
Short answer: not without any server. Browsers can't open connections to each other on their own: even peer-to-peer WebRTC needs a server to introduce players and, for some networks, a relay to carry the traffic. What you can do is make a multiplayer web game without writing or running a server. A hosted relay such as Joinable runs the rooms for you: you add an async script tag and a few hooks, and your game ships as static files like any other web page.
Why a browser game always needs some server
A web page can make outgoing connections only. It can't listen for incoming ones, and most players sit behind home routers and mobile networks that wouldn't let a stranger in anyway. So two browsers that want to talk need something both can reach:
- To find each other: someone has to hand out the room, the invite link or the quick-match pairing.
- To connect: someone has to pass messages until they're connected, or the whole time.
- To stay in sync: someone has to decide when the round starts, what the seed is, who won, and what a player who joins late should see.
The question isn't "server or no server". It's whose server, and how much of the game it knows about.
The options
| You write | You run | What's still a server | |
|---|---|---|---|
| Peer-to-peer WebRTC (with PeerJS or similar) | Signalling, rooms, netcode, reconnects, lobby UI | A signalling server, and a TURN relay for players who can't connect directly | Signalling and TURN |
| A backend-as-a-service (a realtime database, pub/sub) | Netcode on top of shared documents or channels; lobby UI | Nothing, but you pay per read, write or connection | The provider's database |
| A server framework (Colyseus, Nakama) | Server room code and client code | Their server, or their cloud | Your game server |
| A hosted game SDK (PlayroomKit, Photon, Joinable) | Client code: hooks or state calls | Nothing | The provider's relay |
Peer-to-peer WebRTC
WebRTC lets two browsers exchange data directly, which sounds like "no server". In practice:
- Signalling: before two peers can connect, they must swap connection details through a server you run (or a free public one you hope stays up).
- NAT traversal: STUN servers help a player discover their public address. Some networks (strict corporate, some mobile carriers) still block direct links, and those players need a TURN server that relays every packet. That's a server, and it carries real traffic.
- Everything else is yours: who's host, what happens when they leave, late joiners, reconnects, the lobby, invites.
More on the protocols: WebSockets vs WebRTC.
A backend-as-a-service
Realtime databases are a quick way to share a small state between players: a board game's board, a lobby list. They're built around documents and channels rather than game ticks, and their pricing usually counts reads, writes or connections, so check what 20 updates a second per player would cost before you build a fast game on one. You still write the netcode, the lobby and the session logic yourself.
A hosted relay or game SDK
Here the provider runs the rooms. You write only client code. They differ in how much of the session they own: some give you shared state and leave the screens to you; Joinable runs the whole session around play: the invite, quick match, waiting room, shared 3-2-1, live standings, one results screen, rematch and reconnects. Your game supplies four hooks: start a round from a shared seed, report your player, draw the others, and say when you've finished.
What "no server" honestly means with Joinable
There is a server. It's ours, not yours:
- The relay is a Cloudflare Worker with Durable Objects: one object per room, created near the first player. It holds the room's WebSockets, picks the seed and start time, collects results and keeps the current state for late joiners.
- Your game stays static files on any host: your own domain, itch.io, Cloudflare Pages, GitHub Pages.
- Your code never opens a WebSocket. The SDK does, and the kit tells coding agents never to write server code.
- One player's device runs the shared world in Pattern A and B games (the host), and hands over when they leave. In race and score games every device runs its own copy, and in lockstep strategy games every device runs the same battle. The relay never runs your game's code.
<script async src="https://relay.getjoinable.com/sdk.js" data-connect="invite"></script>
(window.JoinableQ = window.JoinableQ || []).push((Joinable) => {
Joinable.game({
profile: 'score',
start({ seed }) { newRound(seed); },
go() { running = true; },
local() { return { score }; },
stop() { showMenu(); },
});
});
window.Joinable?.finish({ score });
What you give up
Being honest about a hosted relay that doesn't run your code:
- Trust. Players' devices report their own results, and in shared worlds the host runs the rules. Fine for friends and casual leaderboards; ranked play with prizes needs a server that runs the game. Joinable doesn't offer that yet.
- Genres. Fighting games need rollback netcode, and competitive shooters need lag compensation on a trusted server. Neither is built.
- Room size. Up to 16 players a room on the biggest plan. Not for massive .io arenas.
- Dependence on a provider. If the relay is unreachable, online play stops. With the async tag, the game itself keeps working single-player.
What it costs
Building and testing are free: no key is needed on localhost. When the game goes live on its real domain you pay per player-hour, not per concurrent player. Details: what multiplayer costs and pricing.
To try it, paste the prompt into your coding agent, or follow how to make a web game multiplayer.
FAQ
Can two browsers connect directly without a server?
Not on their own. WebRTC can carry data directly between browsers, but they need a signalling server to set up the connection, and players on strict networks need a TURN relay for all their traffic.
What is the easiest way to add multiplayer without running a server?
A hosted SDK that runs the rooms for you. With Joinable it's an async script tag and a few hooks in your game; invites, quick match, the waiting room, countdown, results and rematch come with it.
Is a hosted relay peer-to-peer?
No. Every player connects to the relay over a WebSocket, and the relay passes messages on. That costs a hop compared with a direct link, but it works on every network and needs no TURN fallback.
Can I host a multiplayer web game on GitHub Pages or itch.io?
Yes, with a hosted relay. The game is static files on any host; the relay runs elsewhere. With Joinable, add your site's address to your game's key before going live.