Back4App

Activating your Live Query

Introduction

The Query is one of the key concepts for Parse Technology. It allows you to retrieve objects by specifying some conditions, making it easy to build apps such as social networks, dashboards, mobile commerce, and also amazing games. However, Parse.Query is based on a pull model, which is not suitable for apps that need real-time support.

Suppose you are building an app that needs real-time messages like a chat-app. Parse.Query would not be an ideal solution since a user app doesn’t know when another one updated a conversation with a new message. In this case, the database has a new update to inform the other to query from the server to get the updates.

LiveQuery solves this problem. This tool 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.

At this guide, we’re going to show you how to activate LiveQueries to your App.

Prerequisites

To complete this tutorial, you will need:

  • A verified account at Back4App.
  • An app created in Back4App.

How can I use this feature?

When you enable the Live Query feature is a guarantee that you can use more functionalities in Back4App side, so, it has the many different purposes that are described below. You will also learn the process of setting up a subdomain later, in the following instructions.

Step 1 - Locate the feature block

To locate and enable your Live Query feature, log in to your Back4App account and go to the My Apps option and then click on Server Settings. After that, search for the Server URL and Live Query block and select Settings. The Server URL and Live Query section looks like this:

Step 2 - Use Live Query in your App

To enable client-LiveQuery server interaction, it’s necessary to activate the Live Query in Web Hosting box and select the Class that will allow communication between the client and server. The section related to this as shown below:

Setp 3 - Change the default serverURL

You can change the default URL https://parseapi.back4app.com/ to your subdomain * .b4a.io/.

With the guide described above, you’ll be able to set a custom API address with Back4App and enable as well with various features, including using Live Query and changing your ServerURL!