# Room: broadcast() method

> The broadcast() method of the Room interface sends a message to every connection in the room.

The **`broadcast()`** method of the [`Room`](/docs/reference/room-api/room) interface sends a message to every connection in the room, or to every connection but one.

## Syntax

```ts
broadcast(message)
broadcast(message, options)
```

### Parameters

`message`
: The message to send. It may be one of the following types:

  `Uint8Array`
  : Sent as a binary message.

  Any other value
  : Sent as JSON.

`options` Optional
: An object with any of these properties:

  `unreliable`
  : A boolean. If `true`, the message is sent as a WebTransport datagram, or over WebSocket in order with stale ones dropped. Defaults to `false`.

  `except`
  : A connection to leave out, usually the one whose message is being relayed.

### Return value

None (`undefined`).

### Exceptions

`RangeError`
: Thrown if the message is larger than 64 KB.

## Examples

### Relaying a message to everyone else

```ts
// chat.ts
import { defineRoom } from "@irtio/room";

export default defineRoom({
  onMessage(room, connection, message) {
    room.broadcast({ from: connection.player, message }, { except: connection });
  },
});
```

## See also

- [`Room.send()`](/docs/reference/room-api/room/send)
- [State sync](/docs/guides/state-sync), for state every client should have rather than a message
