# Live Query

Live Query allows you to subscribe to a **Parse.Query** you are interested in. Once subscribed, the server will notify clients whenever a **Parse.Object** that matches the **Parse.Query** is created or updated, in real-time.

Suppose you're building a To Do app and multiple users can make edits to the list. **Parse.Query** would require you to constantly poll the server for status. That's not an ideal situation.&#x20;

A Live Query solves this and makes it to where the client can subscribe to a **Parse.Query** and when updates are made, the subscriber will be notified.&#x20;

## Setup

Live Query requires you to configure which collections can be subscribed to. There are two ways to configure collections, [**env.json**](/actinium/live-query.md#env-json) and [**live-query-classnames**](/actinium/live-query.md#live-query-classnames-hook) hook.&#x20;

### env.json

Open the **/src/env.json** file and update the **LIVE\_QUERY\_SETTINGS.classNames** array with the collection name you wish to include.&#x20;

{% code title="/src/env.json" %}

```css
{
    ...
    "LIVE_QUERY_SERVER": true,
    "LIVE_QUERY_SETTINGS": {
        "classNames": ["Changelog", "YourCollection"]
    },
    ...
}
```

{% endcode %}

{% hint style="info" %}
If you have multiple **env.json** files be sure to update them accordingly&#x20;
{% endhint %}

### live-query-classnames hook

{% code title="/src/app/MyPlugin/plugin.js" %}

```javascript
Actinium.Hook.register('live-query-classnames', classNames => {
    classNames.push('MyPluginCollection'); 
});
```

{% endcode %}

{% hint style="warning" %}
Using the **live-query-classnames** hook will execute regardless of your plugin's active status due to the fact that this hook is run before the server starts.&#x20;
{% endhint %}


---

# 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.reactium.io/actinium/live-query.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.
