# RoomClient: readyState property

> The readyState read-only property of the RoomClient interface says where the client's connection is, from connecting to closed.

The **`readyState`** read-only property of the [`RoomClient`](/docs/client/room-client) interface says where the client's connection is, as `WebSocket.readyState` does.

## Value

A string, one of these:

`"connecting"`
: The client is connecting for the first time. It's the value when the client is constructed.

`"waking"`
: The room isn't running, and the router holds the connection while it starts. The client has fired a [`waking` event](/docs/client/room-client/waking-event).

`"open"`
: The router accepted the connection. The first time, [`ready`](/docs/client/room-client/ready) resolves when the full state update that follows is applied.

`"reconnecting"`
: The connection dropped after the client had been ready, and the client is connecting again. The client has fired a [`reconnecting` event](/docs/client/room-client/reconnecting-event).

`"closed"`
: The connection ended for good, after [`close()`](/docs/client/room-client/close) or a close code the client doesn't retry, or the first connection failed: it couldn't be dialled, `timeout` passed or `signal` aborted. The client has fired the [`close` event](/docs/client/room-client/close-event), and it never connects again.

## Description

A connection that drops before the client was first ready goes back to `"connecting"`, not `"reconnecting"`. A room that sleeps while the router holds the connection stays `"open"`; [`asleep`](/docs/client/room-client/asleep) says it's sleeping.

## Examples

### Labelling the connection in a debug overlay

A debug overlay turns each ready state into a label, and says when the room is asleep.

```ts
// overlay.ts
import type { ReadyState, RoomClient } from "@irtio/client";

const labels: Record<ReadyState, string> = {
  connecting: "Connecting",
  waking: "Starting the room",
  open: "Connected",
  reconnecting: "Reconnecting",
  closed: "Disconnected",
};

export function connectionLabel(room: RoomClient): string {
  return room.asleep ? "Connected, room asleep" : labels[room.readyState];
}
```

## See also

- [`RoomClient.ready`](/docs/client/room-client/ready)
- [`RoomClient.asleep`](/docs/client/room-client/asleep)
- [Errors and close codes](/docs/client/errors), for the codes the client reconnects after
