# RoomClient: schema property

> The schema read-only property of the RoomClient interface is the schema the client was given, which it shares with the room.

The **`schema`** read-only property of the [`RoomClient`](/docs/client/room-client) interface is the [`Schema`](/docs/room/schema) the client was given: the room's kinds and calls, from the same `defineSchema()` module the room uses.

## Value

A `Schema`: the `schema` passed to [`connect()`](/docs/client/connect) or the constructor, or an empty schema, with no kinds and no calls, when it was left out.

## Description

The client sends the schema's `hash` when it connects. A room whose build has a schema with another hash closes the connection with 4004, and the client fails with an [`IrtError`](/docs/client/irt-error) named `VersionError`; see [`reloadForNewBuild()`](/docs/client/reloadfornewbuild).

The client types its [`state`](/docs/client/room-client/state), [`private`](/docs/client/room-client/private) and [`calls`](/docs/client/room-client/calls) from the schema, and [`entities`](/docs/client/room-client/entities) decodes each kind's fields with it.

## Examples

### Listening to the shared state's changes

The schema's `state` kind is the kind of the shared state, so code that has only the client can listen to it.

```ts
// scoreboard.ts
import { connect, defineSchema, entity } from "@irtio/client";

const Match = entity("match", { red: "u16", blue: "u16" });
const room = await connect("main", { schema: defineSchema({ state: Match }) });

room.entities.onChange(room.schema.state, (match, changed) => {
  if (changed.includes("red") || changed.includes("blue")) console.log(`${match.red} : ${match.blue}`);
});
```

## See also

- [`Schema`](/docs/room/schema)
- [`defineSchema()`](/docs/room/defineschema)
- [State sync](/docs/room/guides/state-sync)
