parse-server-example icon indicating copy to clipboard operation
parse-server-example copied to clipboard

LiveQuery not responding

Open nicksc423 opened this issue 10 years ago • 2 comments

I am running my parse-server on Heroku, and when I subscribe to an event on my iOS application I get no response. The app is able to save and query the server correctly, but when I create a new row my subscription for Event.Created doesn't fire.

Below is my index.js and the Swift code that I am using (with keys and urls removed)

Index.js:

var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || '',
  masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL || 'https://myserver.com/parse',  // Don't forget to change to https if needed
  oauth: {
   twitter: {
     consumer_key: "", // REQUIRED
     consumer_secret: "" // REQUIRED
   },
   facebook: {
     appIds: ""
   }
  },
  liveQuery: {
    classNames: ['Message']
  }
});

...

var port = process.env.PORT || 1337;
// Initialize a LiveQuery server instance, app is the express app of your Parse Server
var httpServer = require('http').createServer(app);
httpServer.listen(port);
var parseLiveQueryServer = ParseServer.createLiveQueryServer(httpServer);

Swift Code:

let query = PFQuery(className: "Message").whereKey("gameId", equalTo: event!.objectId!)
        let subscription = query.subscribe()
        subscription.handle(Event.Created) { (query, object) in
            print("it worked!")
        }

nicksc423 avatar May 03 '16 19:05 nicksc423

Parse server suddenly stopped responding

sdalai avatar May 09 '16 05:05 sdalai

same here I don't think it's working, have you guys made it work?

kuyazee avatar Mar 28 '17 10:03 kuyazee