Reputation: 3166
I am using SwiftR to integrate signalR chat client in swift. I Converted my obj-c code to swift step by step. Nothing i'm getting from callaback methods as response. Its not even hitting the break point inside the callback
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")}
}
Upvotes: 1
Views: 343
Reputation: 549
You're doing right.
But you've forgot connection.start()
If you're looking into this demo then find #127 line here.
Upvotes: 1