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:
PARSE_SERVER_START_LIVE_QUERY_SERVER=1
PARSE_SERVER_LIVE_QUERY={“classNames”:[“testClass”,“xxxx”]}
Here is my js code :
const Parse = require('parse/node');
Parse.initialize(process.env.PARSE_APP_ID, "", process.env.PARSE_MASTER)
Parse.serverURL = "https://xxx.com/parse"
let query = new Parse.Query("testClass");
let subscription = await query.subscribe()
subscription.on('open', () => {
console.log('subscription opened');
});
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?
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
Ok, finally made it work. I must say the documentation is not very clear/misleading. The environment variable must be
PARSE_SERVER_LIVE_QUERY={“classNames”:[“people”,“monitor”]}
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 ?
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
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 https://github.com/settings/tokens