# RoomCloseEvent: reason property

> The reason read-only property of the RoomCloseEvent interface is the close reason the connection ended or dropped with.

The **`reason`** read-only property of the [`RoomCloseEvent`](/docs/client/room-close-event) interface is the close reason the connection ended or dropped with.

## Value

A string: the router's or the room's close reason, such as the one the room passed to [`room.kick()`](/docs/room/room/kick), or `""` for none. It's `""` when the client closed with [`close()`](/docs/client/room-client/close). When the first connection was aborted by its `signal`, it's the signal's reason as a string.

## Description

`reason` is for showing to the player or logging. Branch on [`code`](/docs/client/room-close-event/code), not on `reason`. On a [`close` event](/docs/client/room-client/close-event), it's also the `reason` of the event's [`error`](/docs/client/room-close-event/error).

## Examples

### Telling a kicked player why

A moderator's kick carries a reason, which the client shows.

```ts
// kicked.ts
import { CloseCode, connect } from "@irtio/client";

const room = await connect("https://rooms.irt.io/my-game/plaza");
const notice = document.querySelector("#notice")!;

room.addEventListener("close", (event) => {
  if (event.code === CloseCode.Kicked) notice.textContent = `Removed from the room: ${event.reason || "no reason given"}`;
});
```

## See also

- [`RoomCloseEvent.code`](/docs/client/room-close-event/code)
- [`Room.kick()`](/docs/room/room/kick), the room side
