【问题标题】:Parse live Query "Invalid HTTP upgrade", code: 403)解析实时查询“无效的 HTTP 升级”,代码:403)
【发布时间】:2019-12-29 10:48:09
【问题描述】:

我已将我的 iOS 应用程序与自托管解析后端连接。我在我的 iOS 应用程序上实现了实时数据更新的实时查询。订阅后显示我和错误:WebSocket did disconnect with error: Optional(Starscream.WSError(type: Starscream.ErrorType.upgradeError, message: "Invalid HTTP upgrade", code: 403))

我在 AppDelegate 中的连接:

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

在我的 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()
        }

【问题讨论】:

  • 您能分享一下您是如何初始化解析服务器的以及您的部署是什么样的吗?
  • 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 } });
  • 您能否使用此代码以及您用于将 Parse API 和 LiveQuery 安装到您的 Express.js 应用程序的代码更新问题?对于 LiveQuery,您应该有类似 this 的内容

标签: ios swift parse-platform parse-ios-sdk


【解决方案1】:

您在哪里托管?这是 AWS 和 NGINX 的常见问题。

你可以配置你的 NGINX 或类似的。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-03
    • 1970-01-01
    • 2016-02-08
    • 2016-04-14
    • 1970-01-01
    • 2019-05-17
    • 2018-04-05
    • 2013-04-24
    相关资源
    最近更新 更多