Init the subscription in created as below. Subscription prints at opening as it should but when I manually edit something in my parseserver nothing prints in the console. I expected it should print every time something changes in the database.
created: function() {
this.initSubscription();
},
methods: {
initSubscription: async function() {
const MyClass= parse.Object.extend("MyClass");
const query = new parse.Query(MyClass);
// do a bit of filtering so only display row where the column "myColumn" matches "thisValue"
query.equalTo("myColumn", "thisValue");
// create a subscription
let subscription= await query.subscribe();
// THIS PRINTS
subscription.on("open", () => {
console.log("subscription opened");
});
// BUT NONE OF THESE WORKS WHEN MANUALLY CHANGING IN DATABASE
subscription.on("create", object => {
console.log("object created", object);
});
subscription.on("update", object => {
console.log("object updated", object);
});
subscription.on("enter", object => {
console.log("object entered", object);
});
},
İf you directly modify objects in database livequery doesn’t work. Objects needs to be created/updated through parse server. Also if you are using multiple parse servers behind a load balancer you need to use redis server. Try modify/create objects with dashboard
I met similar issues: Parse Live Query sometimes doesn’t trigger Create, Update event, while sometimes it works.
I used Parse Server version 5, one parse server on a single physical machine, with only pm2, no other load balancers. Will such situation get the same issue? Should I use redis server for it?
How many instances does PM2 running in the machine? If the answer is more than one then answer is yes. Each instance needs a way to communicate with each other. You need to use Redis.
By PM2 instances, you mean the number of CPUs managed in the PM2? The number of CPUs is 8. But actually now I have configured the redis server, still not works as expected…
Is there any way I could check the log of running status of live query along with its redis?