> For the complete documentation index, see [llms.txt](https://docs.cybus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cybus.io/broker/cybusmq/configuration/self-refreshing-webhooks-cache.md).

# Self-Refreshing Webhooks Cache

How CybusMQ applies changes to users and permissions to MQTT clients, and what happens when the Auth Server is unavailable.

CybusMQ caches the permission checks of the Auth Server, so MQTT clients do not have to wait for a check each time they publish or subscribe.

## Changes to Users and Permissions

CybusMQ applies changes to users and permissions to connected MQTT clients automatically:

* **Permissions and roles**: When you change a user's permissions or roles, or the permissions of a role, the new permissions apply to the user's MQTT clients. If you remove a permission, CybusMQ ends subscriptions to topics that the user can no longer read and rejects publishing to topics that the user can no longer write to.
* **Deleted users**: When you delete a user, CybusMQ disconnects the user's MQTT clients.

## When the Auth Server Is Unavailable

If CybusMQ cannot get user and permission updates from the Auth Server, MQTT clients keep working with the cached permissions. After 15 minutes without a successful update, which is the default timeout, CybusMQ clears its cache and disconnects all MQTT clients as a security measure, so that outdated permissions do not stay in effect. The clients can reconnect when the Auth Server is available again.

### Changing the Timeout

To change the timeout, set the `DOCKER_VERNEMQ_VMQ_WEBHOOKS__SAFETY_PURGE_TIMEOUT` environment variable of CybusMQ to a value in milliseconds. A longer timeout keeps MQTT clients connected through longer Auth Server outages, but outdated permissions also stay in effect for longer. Applying the change restarts CybusMQ, so MQTT clients have to reconnect.

{% tabs %}
{% tab title="Kubernetes" %}
In your `values.yaml` file, add the variable to `broker.env`, which sets environment variables for CybusMQ:

{% code lineNumbers="true" %}

```yaml
broker:
  env:
    - name: DOCKER_VERNEMQ_VMQ_WEBHOOKS__SAFETY_PURGE_TIMEOUT
      value: '1800000' # 30 minutes
```

{% endcode %}

Apply the change with a Helm upgrade. See [Applying Helm Configuration Changes](/cybus-helm-charts/working-with-cybus-helm-charts.md#applying-helm-configuration-changes).
{% endtab %}

{% tab title="Docker" %}
In the `docker-compose.override.yml` file in your Connectware installation directory, add the variable to the `broker` service, which runs CybusMQ:

{% code lineNumbers="true" %}

```yaml
services:
  broker:
    environment:
      DOCKER_VERNEMQ_VMQ_WEBHOOKS__SAFETY_PURGE_TIMEOUT: '1800000' # 30 minutes
```

{% endcode %}

To apply the change, run `docker compose up -d` in the installation directory.
{% endtab %}
{% endtabs %}


---

# 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.cybus.io/broker/cybusmq/configuration/self-refreshing-webhooks-cache.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.
