# RoomClient: generation property

> The generation read-only property of the RoomClient interface is the room's generation, which changes when the room restarts or wakes.

The **`generation`** read-only property of the [`RoomClient`](/docs/client/room-client) interface is the room's generation: a number that changes each time the room starts again, when it restarts or wakes.

## Value

A number, from the router's answer to each connection. It's `0` until the router accepts the first connection.

## Description

Compare generations for equality only: a different number means a room started again from its room state, and the order of the numbers means nothing.

When a reconnect finds the room in the same generation, the client resumes: the room sends only what changed while the client was away, and the client keeps its estimate of [`serverTick()`](/docs/client/room-client/servertick). When the generation changed, every entity leaves the [entity store](/docs/client/room-client/entities) and the room's full state enters again, and predictions and interpolators start over.

## Examples

### Noticing that the room started again

After a reconnect, a game that keeps something outside room state checks whether the room it reconnected to is the same one.

```ts
// restarts.ts
import { connect } from "@irtio/client";

const room = await connect("main");
let generation = room.generation;
room.addEventListener("open", () => {
  if (room.generation !== generation) console.warn("the room started again; rebuilding the scene");
  generation = room.generation;
});
```

## See also

- [`open` event](/docs/client/room-client/open-event)
- [Generations](/docs/room/guides/hibernation#generations), in How rooms hibernate and wake
