# Replay: message event

> The message event of the Replay interface fires for each broadcast the room recorded, when playback passes the tick it was sent in.

The **`message`** event of the [`Replay`](/docs/client/replay) interface fires for each broadcast the room recorded, when [`play()`](/docs/client/replay/play) or [`step()`](/docs/client/replay/step) passes the tick it was sent in.

## Syntax

```ts
addEventListener("message", (event) => {})
```

## Event type

A [`RoomMessageEvent`](/docs/client/room-message-event). It extends `Event` and adds these properties:

[`data`](/docs/client/room-message-event/data) Read only
: The message: JSON parsed, or a `Uint8Array` for a binary message.

[`unreliable`](/docs/client/room-message-event/unreliable) Read only
: `true` if the room sent the message as unreliable.

[`from`](/docs/client/room-message-event#from) Read only
: `undefined`, since the room sent every message in a replay.

## Description

A room records its broadcasts only when it starts the recording with `messages: true`, and never what it sends with [`Room.send()`](/docs/room/room/send); see [`Room.record()`](/docs/room/room/record). A [`seek()`](/docs/client/replay/seek) skips the messages between the two ticks.

The messages of a tick fire before its entity callbacks and its [`tick` event](/docs/client/replay/tick-event).

## Examples

### Replaying the kill feed

A shooter broadcasts each kill, so its replay viewer shows the kill feed as the match plays.

```ts
// kill-feed.ts
import type { Replay } from "@irtio/client/replay";

interface Kill {
  type: "kill";
  by: string;
  victim: string;
}

export function killFeed(replay: Replay, post: (line: string) => void): void {
  replay.addEventListener("message", ({ data }) => {
    const m = data as Partial<Kill>;
    if (m.type === "kill") post(`${m.by} took out ${m.victim}`);
  });
}
```

## See also

- [`message` event](/docs/client/room-client/message-event), a live `RoomClient`'s
- [`Room.record()`](/docs/room/room/record)
- [`Room.broadcast()`](/docs/room/room/broadcast)
