0

I have Connected my iOS Apps with self-hosted parse backend.I am implemented live query for real time data update on my iOS Apps. After subscription its showing me and error: WebSocket did disconnect with error: Optional(Starscream.WSError(type: Starscream.ErrorType.upgradeError, message: "Invalid HTTP upgrade", code: 403))

My connection in AppDelegate:

let parseConfig = ParseClientConfiguration {
            $0.applicationId = "myAppId"
            $0.clientKey = "fashionclip"
            $0.server = "https://parse.knowell.xyz/parse"
        }
        Parse.initialize(with: parseConfig)

In my ViewDidLoad:

        var armorQuery: PFQuery<Armor> {
            return (Armor.query()!
                .whereKeyExists("Name")
                .order(byAscending: "createdAt")) as! PFQuery<Armor>
        }
        client = ParseLiveQuery.Client(server: "https://parse.knowell.xyz/parse")
        subscription = client.subscribe(armorQuery)
            // handle creation events, we can also listen for update, leave, enter events
            .handle(Event.created) { _, armor in
                print("\(armor.Name)")
                self.sarverData = armor.Name
                self.myTableView.reloadData()
        }
rici
  • 234,347
  • 28
  • 237
  • 341
Ekramul Hoque
  • 672
  • 4
  • 17
  • Can you share how you are initializing your parse server and how your deployment looks like? – Davi Macêdo Aug 24 '19 at 20:03
  • `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 || 'myAppId', masterKey: process.env.MASTER_KEY || 'codenext', //Add your master key here. Keep it secret! serverURL: process.env.SERVER_URL || 'https://parse.knowell.xyz/parse', // Don't forget to change to https if needed clientKey: 'fashionclip', restApiKey: 'fashionclipios', liveQuery: { classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions } });` – Ekramul Hoque Aug 25 '19 at 11:45
  • Can you please update the question with this code and also the code that you are using to mount Parse API and LiveQuery to your Express.js app? For LiveQuery you should have something like [this](https://docs.parseplatform.org/parse-server/guide/#server-setup) – Davi Macêdo Aug 25 '19 at 16:36

1 Answers1

0

Where are you hosting? This is a common problem with AWS and NGINX.

You can configure your NGINX or similar.

https://github.com/SoBump/ParseLiveQueryHelp/blob/master/guide.md