# RoomClient: stats property

> The stats read-only property of the RoomClient interface counts the messages and bytes the client sent and received.

The **`stats`** read-only property of the [`RoomClient`](/docs/client/room-client) interface counts the messages and bytes the client sent and received, in all and by message type, and gives the size of the last state update.

## Value

A [`WireStats`](/docs/client/wire-stats). The same object counts from the client's construction, across reconnects.

## Description

Sizes are of the protocol's messages as encoded, without the transport's own framing, such as a WebSocket frame header. `stats.received.state.bytes` is what state sync cost, and `stats.sent.input.bytes` what prediction's inputs cost. Sample the counters at an interval to get rates.

## Examples

### Comparing what state sync and inputs cost

A debug panel compares the bytes of state updates received with the bytes of inputs sent.

```ts
// traffic.ts
import type { RoomClient } from "@irtio/client";

export function trafficReport(room: RoomClient): string {
  const state = room.stats.received.state?.bytes ?? 0;
  const inputs = room.stats.sent.input?.bytes ?? 0;
  return `state ${(state / 1024).toFixed(1)} KB in, inputs ${(inputs / 1024).toFixed(1)} KB out`;
}
```

## See also

- [`WireStats`](/docs/client/wire-stats)
- [`RoomClient.update`](/docs/client/room-client/update)
