How Configuring Live Query Server on self hosted Parse

Hi Community,
Recently I hosted a Parse server on the cloud, I wanted to enable Live Query. I checked the documentation but was unable to find which file to configure it in. Can someone please help me to do the configuration?

It depends on how you are running the parse-server and how do you want to configure it. If using the stock docker image, there are two pieces to configure:

  1. Interop of the parse-server with the live query server - it needs the livequeryserver url and what classNames can be monitored. This is the liveQuery part of the config.
  2. Instruct parse-server to start the live query server (ParseLiveQueryServer). This is either the startLiveQueryServer: true option or a dedicated options object for initializing the live query sever liveQueryServerOptions

Note that these options also have their env variable equivalents if you prefer to configure that way.

{
  "appId": "yourAppId",
  "masterKey": "yourMasterKey",
  "databaseURI": "mongodb://your-mongodb-url",
  "cloud": "./cloud/main.js",
  "serverURL": "http://localhost:1337/parse",
  "liveQuery": {
    "classNames": ["YourClassName"],  // Classes to be monitored by LiveQuery
    "liveQueryServerURL": "ws://localhost:1337" // WebSocket URL for LiveQuery
  },
  "startLiveQueryServer": true
  "port": 1337,  // Port where the Parse Server will run
  "publicServerURL": "http://localhost:1337/parse",  // Public URL of your Parse Server
  "allowClientClassCreation": true // (Optional) Allows clients to create new classes, typically used during development
}

note that you need to set "startLiveQueryServer": true so the server is started, or add this to config.json as well:

"liveQueryServerOptions": {
    "logLevel": "info",  // Logging level for the Live Query server
    "redisURL": "redis://localhost:6379"  // Redis URL for distributed setups
  },

hi @evtimmy

Thank you for your response.
The above configuration worked for me.

1 Like