# Parse Live Query on Symbyoz

PFQuery is one of the key concepts for Parse. It allows you to retrieves PFObject  by specifying some conditions, making it easy to build apps such as a dashboard, a todo list or even some strategy games. However, PFQuery is based on a **PULL model**, which is not suitable for apps that need real-time support.

Suppose you are building an app that allows multiple users to edit the same file at the same time like a Chat. \
PFQuery would not be an ideal tool since you can not know when to query from the server to get the updates.

To solve this problem, we introduce **Parse LiveQuery**. This tool allows you **to subscribe to a PFQuery** you are interested in. Once subscribed, the server will notify clients whenever a PFObject that matches the PFQuery is created or updated, in real-time. <br>

Live Query is a **PUSH model.**

![](/files/-LTwOQkZLsyr041mczLd)

{% tabs %}
{% tab title="Java" %}

```java
public void getLiveMessages()
{
        ParseLiveQueryClient parseLiveQueryClient = ParseLiveQueryClient.Factory.getClient();

        ParseQuery<ParseObject> queryMessage = ParseQuery.getQuery("Messages");

        SubscriptionHandling<ParseObject> messageChannel = parseLiveQueryClient.subscribe(queryMessage);

        // CHOOS ONLY ONE BETWEEN handleEvent and handleEvents
        messageChannel.handleEvents(new SubscriptionHandling.HandleEventsCallback<ParseObject>()
        {
            @Override
            public void onEvents(ParseQuery<ParseObject> query, SubscriptionHandling.Event event, ParseObject object)
            {
                // Triggered when an object from the class Messages is created, updated or deleted
                // use method handleEvent instead of handleEvents to get ONLY created object
            }
        });

}
```

{% endtab %}
{% endtabs %}


---

# 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.symbyoz.io/news/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.
