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