0

我已经将我的 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()
        }
4

1 回答 1

0

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

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

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

于 2019-08-29T00:17:08.387 回答