# RoomCloseEvent: wasClean property

> The wasClean read-only property of the RoomCloseEvent interface says whether this client closed the connection with close().

The **`wasClean`** read-only property of the [`RoomCloseEvent`](/docs/client/room-close-event) interface says whether this client closed the connection itself, with [`close()`](/docs/client/room-client/close).

## Value

A boolean. `true` on a [`close` event](/docs/client/room-client/close-event) after the client called `close()`, when [`error`](/docs/client/room-close-event/error) is `undefined`. `false` otherwise, and always `false` on a [`reconnecting` event](/docs/client/room-client/reconnecting-event).

## Description

Unlike the web's `CloseEvent.wasClean`, it doesn't say whether the transport closed cleanly: a room that closes the connection with a code, such as 4006 for a kick, gives `false`. A handoff that doesn't keep this client closes it with `close()`, so its `close` event has `wasClean` true.

## Examples

### Going back to the menu after leaving

A Leave button closes the client, and only that close goes straight back to the menu.

```ts
// leave-button.ts
import { connect } from "@irtio/client";

const room = await connect("https://rooms.irt.io/my-game/arena");
document.querySelector("#leave")!.addEventListener("click", () => room.close());

room.addEventListener("close", (event) => {
  if (event.wasClean) console.log("back to the menu");
  else console.error(`lost the room: ${event.error?.message}`);
});
```

## See also

- [`RoomClient.close()`](/docs/client/room-client/close)
- [`RoomCloseEvent.error`](/docs/client/room-close-event/error)
