Cannot connect to Live Queries

I’m trying to connect to Live Queries via Node JS.

I’m using the latest version of parse and I’ve installed via docker. In my docker I have the following environnement variables:

Here is my js code :

const Parse = require('parse/node');
Parse.initialize(process.env.PARSE_APP_ID, "", process.env.PARSE_MASTER)
Parse.serverURL = ""

let query = new Parse.Query("testClass");
let subscription = await query.subscribe()

subscription.on('open', () => {
        console.log('subscription opened');

Nothing happens/nothing shows in my console

Can anyone help me?

Do you see any error message or useful information on your docker logs? Are you using any reverse proxy on top of your docker container? Is it ready to receive ws connections? Could you please also add this code and let me know the results?

Parse.LiveQuery.on('open', () => {
  console.log('socket connection established');
Parse.LiveQuery.on('close', () => {
  console.log('socket connection closed');
Parse.LiveQuery.on('error', (error) => {

Your “proxy” answer got me on the right track !!! I’m using Caprover as my PaaS, and I had to enable websockets

Thanks @davimacedo

…however @davimacedo , I’m not seing any updates when my table is updated.

Now, in my console, I have

sub {"_events":{},"_eventsCount":1,"id":1,"query":{"where":{}},"subscribePromise":{},"subscribed":true}
subscription opened

However, when I add data into my class, nothing happens.

How do you create objects? objects need to be created through parse server which means if you are creating or modifying objects directly in database live query will not work. Try creating objects with dashboard. Also you need to specify classes that you will listen on parse server constructor

Objects are created using a function, using

const Object = Parse.Object.extend("xxx");
        const object = new Object();
        object.set("dateUnix", timestamp)
            .then((object) => {

My feeling is that the issues comes from the fact that I have to provide a list of live queries like:

liveQuery: {
      classNames: ["xxxx"]

I’m using docker so I’m specifying this in the env variables, like presented here: (so adding PARSE_SERVER_LIVEQUERY_CLASSNAMES=xxxx). But it does not seem to work.

Ok, finally made it work. I must say the documentation is not very clear/misleading. The environment variable must be

Thanks for sharing the solution. Would you be interested in sending a PR to the documentation repository improving that for the community?

I’m more than happy to help and contribute. I’m a hobby developer and never done this before. Can you guide me or can I just send you an explication of my final solution for you to update ?

Here is the steps:

1- Fork the doc repo.
2- Clone the repo to your computer with git clone method.
3- create a new branch with git branch myfix
4- switch to that branch git checkout myfix
5- modify the files you want to contribute.
6- commit changes with git commit -a -m "doc improvments or whatever you can modify this"
7- push commit with git push

After all of this, Go to the repository on your profile. You will see a message with a button which says create a pull request. Click that and create a pull request. After that team members will review your changes and if the changes are ok, they will merge it.

Edit: ıf this is the first time you use git, ıt will ask you to configure global config. If thats the case
run these commands

git config --global your-mail-adress
git config --global your-name

Also it may ask for your credentials. You will enter your username. And for the password you have to enter token. You can create token here