> For the complete documentation index, see [llms.txt](https://docs.servoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.servoy.com/reference/servoyextensions/server-plugins/clientmanager/broadcaster.md).

# Broadcaster

## Overview

The `Broadcaster` object facilitates real-time communication and message broadcasting to clients connected to the same channel, offering methods for message sending, channel management, and listener identification.

## Functionality

Broadcasters can send messages to all other listeners on their channel using the `broadcastMessage(message)` method. The object also allows retrieval of the channel's name via `getChannelName()` and the broadcaster's nickname using `getName()`. To clean up resources or stop listening, the `destroy()` method unregisters the broadcaster from the channel.

## Methods Summarized

| Type                                                     | Name                                                   | Summary                                                                                |
| -------------------------------------------------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------- |
| void                                                     | [broadcastMessage(message)](#broadcastmessage-message) | Sends a message to the all other listeners of the channel of this broadcaster.         |
| void                                                     | [destroy()](#destroy)                                  | Destroyes and unregister the listener for this channel.                                |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [getChannelName()](#getchannelname)                    | get the channel name where this broadcaster listens and sends messages to.             |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [getName()](#getname)                                  | Get the (nick) name for this broadcaster that will be send to other channel listeners. |

## Methods Detailed

### broadcastMessage(message)

Sends a message to the all other listeners of the channel of this broadcaster.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **message** The message to send to the other users of this channel

**Returns:** void

### destroy()

Destroyes and unregister the listener for this channel.

**Returns:** void

### getChannelName()

get the channel name where this broadcaster listens and sends messages to.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The channel name where this broadcaster listens and sends messages to.

### getName()

Get the (nick) name for this broadcaster that will be send to other channel listeners.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The (nick) name for this broadcaster that will be sent to other channel listeners

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.servoy.com/reference/servoyextensions/server-plugins/clientmanager/broadcaster.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
