I am trying to get live queries working with iOS and Parse-Server. The following is my setup for my Parse-Server:
...
let api = new ParseServer({
databaseURI: databaseUri || constants.DATABASE_URI,
cloud: process.env.CLOUD_CODE_MAIN || constants.CLOUD_CODE_MAIN,
appId: process.env.APP_ID || constants.APP_ID,
masterKey: process.env.MASTER_KEY || constants.MASTER_KEY,
serverURL: process.env.SERVER_URL || constants.LOCAL_SERVER_URL,
fileKey: process.env.FILE_KEY || constants.FILE_KEY,
appName: process.env.APP_NAME || constants.APP_NAME,
publicServerURL: process.env.SERVER_URL || constants.LOCAL_SERVER_URL,
liveQuery: {
classNames: [Parse.User]
}
});
...
let port = process.env.PORT || 1337;
let httpServer = require('http').createServer(app);
httpServer.listen(port, function () {
console.log('parse_server running on port ' + port + '.');
});
ParseServer.createLiveQueryServer(httpServer, {logLevel: 'VERBOSE'});
...
And this is my code in the iOS app:
let liveQueryClient = ParseLiveQuery.Client(server: "ws://serverurl/", applicationId: "appID", clientKey: "clientKey")
let query = PFUser.query()?.whereKey("objectId", equalTo: "ABC123") as! PFQuery<PFUser>
let subscription = self.liveQueryClient.subscribe(query).handle(Event.updated) { _, user in
debugprint("\(user)")
}
Debugging on local, I can see the user is connecting using the socket because the server logs:
info: Create new client: 0
and when I disconnect, the server logs:
info: Client disconnect: 0
My problem is that whenever I modify the User object in Parse Dashboard, nothings logs on the server side, and the client doesn't receive any events.
Is there another way to set this up?
Can the User class not be used in live queries?