# RoomClient: voice property

> The voice read-only property of the RoomClient interface is the voice server's URL and the connection's token, when the project uses voice.

The **`voice`** read-only property of the [`RoomClient`](/docs/client/room-client) interface is what the client needs to join the project's voice server: the server's URL and the connection's token.

## Value

An object with these properties, or `undefined` when the project doesn't use voice:

`url`
: A string: the voice server's URL.

`token`
: A string: the token that admits this connection to the voice server.

It's also `undefined` after each reconnect, until the router grants voice again.

## Description

The router grants voice to each connection of a project that uses it, and the [`voice` event](/docs/client/room-client/voice-event) fires when it does. [`joinVoice()`](/docs/client/joinvoice), from `@irtio/client/voice`, uses it to join the voice server, so a game rarely reads it itself.

## Examples

### Showing the voice button once voice is granted

A game shows its voice button only while the room grants the player voice, checking again on each grant and reconnect.

```ts
// voice-button.ts
import type { RoomClient } from "@irtio/client";

export function voiceButton(room: RoomClient, button: HTMLButtonElement): void {
  const show = () => {
    button.hidden = room.voice === undefined;
  };
  room.addEventListener("voice", show);
  room.addEventListener("open", show);
  show();
}
```

## See also

- [`RoomClient.peers`](/docs/client/room-client/peers)
- [`joinVoice()`](/docs/client/joinvoice)
- [Proximity voice](/docs/room/guides/voice#client)
