Reactium
  • Quick Start
  • Discuss
  • Approach
    • Architecture
    • DDD Introduction
    • Domain Model
  • Reactium App Foundation
    • Reactium Guides
      • Creating a Simple Single Page Web App (SPA)
      • Creating a Sassy Style Sheet
      • Reactium Core
      • Reactium + Actinium (APIs)
      • Reactium + REST
      • Plugin Module Guide
      • Animating React Routes
      • Reactium in Production
    • Reactium Domain Model
      • Basic Domain Model
      • Runtime Domain Model
      • Buildtime Domain Model
    • Reactium SDK
      • Reactium SDK Reference
    • Updating Reactium
  • Installing Foundations
    • Before You Install
    • Install Reactium
    • Install Actinium
  • Reactium API Foundation (Actinium)
    • Actinium Core
    • Setting up your User
    • Actinium SDK
      • Actinium SDK Reference
    • Actinium Domain Model
    • Extending
    • Updating
    • Live Query
  • Reactium Toolkit
    • Overview
    • Installation
    • Configuration
    • Customization
    • Creating Elements
      • Sidebar Elements
      • Toolbar Elements
      • Documentation Elements
    • Components
      • Sidebar
      • MenuLink
      • Element
      • Code
      • Markdown
      • Icon
    • Toolkit SDK
Powered by GitBook
On this page
  • Setup
  • env.json
  • live-query-classnames hook
  1. Reactium API Foundation (Actinium)

Live Query

PreviousUpdatingNextOverview

Last updated 5 years ago

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.

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.

Setup

Live Query requires you to configure which collections can be subscribed to. There are two ways to configure collections, and hook.

env.json

Open the /src/env.json file and update the LIVE_QUERY_SETTINGS.classNames array with the collection name you wish to include.

/src/env.json
{
    ...
    "LIVE_QUERY_SERVER": true,
    "LIVE_QUERY_SETTINGS": {
        "classNames": ["Changelog", "YourCollection"]
    },
    ...
}

If you have multiple env.json files be sure to update them accordingly

live-query-classnames hook

/src/app/MyPlugin/plugin.js
Actinium.Hook.register('live-query-classnames', classNames => {
    classNames.push('MyPluginCollection'); 
});

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.

env.json
live-query-classnames