Thanks for the reply and here is the parse config
const config = {
databaseURI: getParseUri(),
cloud: __dirname + '/cloud/main.js',
appId: glbdef.PS_APPID,
masterKey: glbsrvdef.PS_MASTERKEY,
javascriptKey: glbdef.PS_JSID,
liveQuery: {
classNames: ['NotifyClient'],
logLevel: 'VERBOSE'
},
auth: {
NetManAuth: {
module: NetManAuth,
option1: 'hello',
option2: 'world',
}
},
verbose: true,
maxUploadSize: "500mb"
};
init subscription:
// livequery event handling
enableEvents: function() {
var me = this;
var sUserSessionToken = '';
var objCurrentUser = Parse.User.current();
if (typeof objCurrentUser != 'undefined' && objCurrentUser != null) {
sUserSessionToken = objCurrentUser.getSessionToken();
}
let LiveQueryClient = Parse.LiveQueryClient;
let client = new LiveQueryClient({
applicationId: glbdef.PS_APPID,
serverURL: 'wss://' + glbdef.NFSHOST + ":" + glbdef.NFSPORT + '/',
javascriptKey: glbdef.PS_JSID
});
client.open();
let query = new Parse.Query('NotifyClient');
console.log('using sessionToken for liveQuery: ' + sUserSessionToken);
let subscription = client.subscribe(query, sUserSessionToken);
// let subscription = client.subscribe(query);
subscription.on('open', () => {
console.log('subscription opened for ChatMessageController');
});
subscription.on('create', (object) => {
console.log('object created ' + object.id + ' - ' + object.get('updatedAt'));
});
subscription.on('update', (object) => {
console.log('object updated ' + object.id + ' - ' + object.get('updatedAt'));
});
},
and here how I initiate a NotifyClient class
notifyClients: async function(sObjectId, sAct, sClass = 'ChatMsg') {
const NotifyClient = Parse.Object.extend("NotifyClient");
const objNotifyClient = new NotifyClient();
objNotifyClient.set("data", {
id: sObjectId,
cls: sClass,
act: sAct
});
// (*1)
// var msgACL = new Parse.ACL();
// msgACL.setPublicWriteAccess(true);
// msgACL.setRoleReadAccess(sUserRole, true);
// objNotifyClient.setACL(msgACL);
objNotifyClient.save().then((objNotify) => {
// Execute any logic that should take place after the object is saved.
console.log('New notify object created with objectId: ' + objNotify.id);
}, (error) => {
// Execute any logic that should take place if the save fails.
// error is a Parse.Error with an error code and message.
console.log('Failed to create new object, with error code: ' + error.message);
});
}
if I uncomment the code on (*1) I get no notifications on clients (I am testing with one role and in the role - sUserRole - are all users). I am working on Windows 2019 with node.js 14.15.5.
Thanks