# Joining a server

> Every step of a Rove join, from the first HTTP request to the first frame of Luau, with the status codes and packets involved.
> Rove documentation: https://docs.rove.wtf/join

A join is two conversations. The first is HTTP with Roblox's web APIs: who you are, which place, which server. The second is the game connection itself: QUIC to the server Roblox picked, a login handshake, then a stream of replication until the world is complete enough to run scripts in.

Step through it:

1. **Sign in** (Who is this?, talking to the Roblox web APIs). Rove checks the cookie with Roblox before anything else, so an expired sign-in fails here, not halfway through a join. Every request from here on carries the cookie, a Windows player User-Agent with the current client version, and the headers the website sends. A 403 with a CSRF token is retried once.
   On the wire: → GET users.roblox.com/v1/users/authenticated; ← 200 { id, name, displayName }
2. **Find the place** (Is it playable?, talking to the Roblox web APIs). A place ID is checked against Roblox's place details. Share links and private servers are resolved to the codes gamejoin wants. A place that isn't public, or doesn't exist, stops here with “Place is not verified playable”.
   On the wire: → GET games.roblox.com/v1/games/multiget-place-details; ← { isPlayable: true, universeId }
3. **Ask for a server** (Status 0, 1, 13, 22 … 2, talking to the Roblox web APIs). Rove posts to gamejoin and keeps asking while Roblox says to wait: 0 and 1 while it finds a server, 13 when it's rate limiting, 22 while you're queued for a full one. Status 2 means ready. Rove checks the answer is for this account and place before going on.
   On the wire: → POST gamejoin.roblox.com/v1/join-game; ← { status: 1 }  no server yet; … 3 s; → POST /v1/join-game; ← { status: 2, joinScript }
4. **Connect** (QUIC, pinned, talking to the game server). The answer names a server and the hashes of its certificate. Rove connects with QUIC (ALPN h3) and accepts only that certificate, then opens a WebTransport session with its capabilities. It needs the bytecode-range capability; without it the join stops.
   On the wire: → QUIC Initial · ALPN h3; ← certificate (hash pinned); → CONNECT /wt  X-Rbx-Capabilities; ← 200
5. **Log in** (Five packets, talking to the game server). Early auth from the join ticket, then protocol sync (version 36, bytecode 13–14), verification, the ticket itself with the session ID, and an empty server ID. These are built from fields in the join answer; Rove doesn't invent any of them.
   On the wire: → A8  early auth; → 144  protocol sync; → 146  verification; → 138  ticket; → 143  server id
6. **Schema** (Numbers for everything, talking to the game server). The server sends its feature flags and its schema: a compressed table that numbers every class, property, event and enum it knows. Everything after this refers to classes and properties by those numbers, which is why a newer Roblox version doesn't break the decoder.
   On the wire: ← 147  feature flags; ← 151  schema (zstd); ← 129  services + scope
7. **Initial world** (Join data, talking to the game server). The world arrives in compressed join-data batches, with shared strings (scripts, meshes) sent once and referenced by hash. Tag 12 marks top-level replication complete; tag 13, join data complete.
   On the wire: ← 131 · 22  join data (zstd); ← 131 · 2  new instances …; ← 131 · 16  tag 12; ← 131 · 16  tag 13
8. **Streaming** (Tell it where you are, talking to the game server). In streaming places the server only sends what's near the replication focus. Rove sends a focus for each region it receives and, once the first region lands, a streaming resume. Some servers hold the character back until that resume arrives.
   On the wire: ← 131 · 13  stream data; → 131 · 26  replication focus; → streaming resume; ← your character
9. **Scripts run** (Ready and bound, talking to the the Luau VM). Once join data is complete and the local player is known, Luau starts: your script, then the game's own LocalScripts from ReplicatedFirst, the character, PlayerScripts, PlayerGui and Backpack. Every received script is checked against Roblox's public signing keys before it loads.
   On the wire: ← tag 13 + LocalPlayer; → ▶ your script; → ▶ game LocalScripts

What can go differently:

- **queued for a full server** (step 3, Status 22): The server you asked for is full. Rove keeps its place in the queue for up to 60 checks, about three minutes.
- **rate limited** (step 3, Status 13): Roblox is rate limiting joins from this network. Rove waits longer between tries: 6 seconds, not 3.
- **server full** (step 3, Status 6): Status 6 isn't a wait. Rove stops and says so; pick another server. The join stops with "That server is full".
- **expired sign-in** (step 1, 401): The cookie is checked first, so a stale one fails here in a few milliseconds, not after a server has been allocated. The join stops with "Roblox says this sign-in has expired".

## Asking for a server

Rove posts to `gamejoin.roblox.com` with the place ID and a fresh `gameJoinAttemptId`:

| Path | Used for |
|---|---|
| `/v1/join-game` | a public place |
| `/v1/join-game-instance` | a specific server (`--job-id`, sent as `gameId`) |
| `/v1/join-private-game` | a private server, by `linkCode` or `accessCode` |

Every request carries the cookie, a Windows player User-Agent with the current client version (fetched from `clientsettings.roblox.com` and cached for six hours), and the headers the website would send. If Roblox answers 403 with an `x-csrf-token`, Rove stores the token per host and retries once; a challenge header is never retried.

### Status codes

The answer has a `status`. Rove keeps asking while Roblox says to wait, and stops on anything else:

| Status | Meaning | What Rove does |
|---|---|---|
| `0`, `1` | No server yet | Retries every 3 s, up to 8 attempts |
| `2` | Ready | Checks the answer is for this account and place, then connects |
| `13` | Flooded (rate limited) | Retries every 6 s |
| `22` | Queued for a slot in that server | Keeps its place for up to 60 checks (about three minutes) |
| `6` | Server full | Stops: "That server is full" |
| anything else | Rejected | Stops and shows Roblox's own message |

The official client polls the same set; Rove found them in its join handler.

## The connection

The ready answer names a server and how to reach it. Rove connects with QUIC (the `quinn` library), checking the server's certificate against hashes from the join answer, not a certificate authority. On top of QUIC it opens a WebTransport session at `/wt` with its capabilities in a header. Every UDP datagram is wrapped in Roblox's routing header with the routing token from the join.

| Setting | Value |
|---|---|
| ALPN | `h3` |
| Idle timeout | 15 s, keep-alive every 2 s |
| Connect timeout | 20 s |
| Required capability | bytecode range (`0x100000`); without it Rove stops with `bytecode-range-negotiation-unavailable` |

## Logging in

Five packets, in order, on the login channel:

1. **Early auth** (`0xA8`), built from the ticket blobs in the join answer.
2. **Protocol sync** (`144`): protocol version 36, the bytecode range Rove reads (13–14) and identity fields the server issued.
3. **Verification** (`146`).
4. **Ticket** (`138`): user ID, ticket, version, checksum and session ID.
5. **Server ID** (`143`), empty.

The server answers with its feature flags (`147`), the network schema (`151`) that numbers every class, property and event, and the top-level services (`129`).

## Getting the world

Then replication starts: `ID_DATA` packets (`131`) full of new instances, property changes and events, and `ID_ISR` (`161`) with physics state. [Replication](https://docs.rove.wtf/replication) covers what's in them.

In places with streaming enabled the server only sends what's near you, and it needs to be told where "you" are. Rove sends a replication focus for each region it receives and, once any region has arrived, a streaming resume. Some streaming servers hold back the character until they get it.

## When scripts start

Two things must be true before any Luau runs: the server has said initial replication is complete (a tag item with value `13`, `JoinDataCompleted`), and the local player is known. From that frame on:

- your script (`--script`, or whatever you run from the app) runs,
- received game scripts run if they're LocalScripts in ReplicatedFirst, your character, PlayerScripts, PlayerGui or Backpack, or Scripts with `RunContext` set to `Client`, and aren't disabled.

Each received script's bytecode is checked against Roblox's public signing keys before it's allowed to load.

## Leaving

A session ends when you leave, when its time is up, or when the server closes it. The server's reason is kept in the session report:

| Packet | Recorded as |
|---|---|
| `21` | `disconnection_notification` |
| `22` | `connection_lost` |
| `142` | `protocol_mismatch` (reason 259) |
| `152` / `250` | `server_kick` (reason 267), with the kick message |
| `146` not verified | `placeid_verification_failed` (reason 263) |
