# PresenceEntry

> The PresenceEntry interface of the Client API is one player's presence as a client sees it, with its player ID, name, status and whether it's connected.

The **`PresenceEntry`** interface of the [Client API](/docs/client) is one player's entry in [`room.presence`](/docs/client/room-client/presence): their player ID, name and status, and whether they have an open connection. Every client sees the same entry.

[`PresenceList.get()`](/docs/client/presence-list/get) and [`me`](/docs/client/presence-list/me) return one, iterating `room.presence` visits each, and the [`PresenceList`](/docs/client/presence-list) events carry them in a [`PresenceEvent`](/docs/client/presence-event). Its properties are read only and show the entry's values as of the last state update; the local player changes their own status with [`setStatus()`](/docs/client/presence-list/setstatus).

## Instance properties

`PresenceEntry.player`
: A string, the player ID. For a bot, its bot ID, which starts with `bot:`; `isBot()` tells them apart.

`PresenceEntry.name`
: A string of at most 64 characters, which the room sets with [`Presence.set()`](/docs/room/presence/set). It starts as the `name` string of the player token's `meta`, when there's one of at most 64 characters, and `""` otherwise.

`PresenceEntry.status`
: A JSON value of at most 1 KB as JSON, which the player sets from their client and the room may replace. `null` until set.

`PresenceEntry.connected`
: A boolean. `false` while the player has no open connection, from just after their last one closes until their entry goes 10 seconds later; `true` otherwise, and always for a bot.

## Description

An entry's properties change with each state update. A player who reconnects within the 10-second grace keeps their entry and status. After a resync, such as on a change of the room's generation, each entry is a new object, so look entries up with `get()` rather than keeping them.

## Examples

### Listing who's ready

Each player sets a `ready` flag in their status. The client lists the connected players and whether each is ready.

```ts
// ready-check.ts
import { connect, type PresenceEntry } from "@irtio/client";

const room = await connect("lobby");

function isReady(entry: PresenceEntry): boolean {
  const status = entry.status as { ready?: unknown } | null;
  return status?.ready === true;
}

room.addEventListener("update", () => {
  for (const entry of room.presence) {
    if (entry.connected) console.log(`${entry.name || entry.player}: ${isReady(entry) ? "ready" : "not ready"}`);
  }
});
```

`status` is whatever the player set, so the client checks its shape before using it.

## See also

- [`PresenceList`](/docs/client/presence-list)
- [`PresenceEntry`](/docs/room/presence-entry), the room's side
- [Entry fields](/docs/room/guides/presence#entry-fields)
