# Messaging

Messaging is the BetterForms implementation of the [WebSocket](https://en.wikipedia.org/wiki/WebSocket) protocol, which enables a persistent connection between the client and the server.

{% hint style="info" %}
Requires version 0.10.14 or later
{% endhint %}

## Concepts

In order to send **messages** from your FileMaker server to users actively viewing your BetterForms app, users need to join **channels**. Channels can be divided in two different scopes:

* **anonymous** channels
  * available for anyone to join, login not requied
* **authenticated** channels
  * the user must be logged in to join the channel

{% hint style="info" %}
**TIP:** All messaging is scoped to the domain of the application. If your app has multiple domains, you will not be able to send messages directly across domains.

( This can be handled from within FileMaker )
{% endhint %}

Each new tab that a user opens will join its own private channel that will be namespaced as **tab|connectionID**.

For authenticated channels, users are automatically set to listen to their added channels once they log in. On the other hand, anonymous channels will not be persistent and users will not be automatically reconnected to this type of channel if they refresh the page or open a new tab.

All messages sent to a channel are broadcasted to all users currently listening to that channel. Therefore, it is important to architect well the scope of each channel to optimize and control what and how much data each channel/user will receive.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.klai.studio/v1/reference/messaging-ver-0.10.14+.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
