我正在使用SwiftR在swift中集成signalR聊天客户端。我将我的obj-c代码逐步转换为swift。我没有从callaback方法得到任何反应。它甚至没有达到回调中的断点
SwiftR.connect("https://chat.f.com") { connection in
connection.headers=["Authorization":bearerKey]
self.chatHub = connection.createHubProxy("MobileChatHub")
self.chatHub?.on("ChatContactsResponse", callback: { (response) in
print("ChatContactsResponse")
print(response as AnyObject)
})
self.chatHub?.on("GetChatsResponse", callback: { (response) in
print("GetChatsResponse")
print(response as AnyObject)
})
self.chatHub?.on("GetChatsResponse", callback: { (response) in
print("GetChatsResponse")
print(response as AnyObject)
})
connection.starting = { print("started")}
connection.connected = { print("connected: \(connection.connectionID)") }
connection.connectionSlow = { print("connectionSlow") }
connection.reconnecting = { print("reconnecting") }
connection.reconnected = { print("reconnected") }
connection.disconnected = { print("disconnected")}
}