Open AnandPGautam opened 6 years ago
@AnandPGautam @adamhartford Please help. I am also facing the same issue. Please check my implementation as:
` func setUpSignalR() {
connection = SignalR(kConnection)
connection.useWKWebView = false
chatHub = Hub(kHub)
connection.addHub(chatHub)
chatHub.on(kRoom) { [weak self] args in
print("ARGS : ",args as Any)
}
// SignalR events
connection.starting = { [weak self] in
}
// connection.
connection.reconnecting = { [weak self] in
}
connection.connected = { [weak self] in
print("Connection ID: \(self!.connection.connectionID!)")
}
connection.reconnected = { [weak self] in
}
connection.disconnected = { [weak self] in
}
connection.connectionSlow = { print("Connection slow...") }
connection.error = { [weak self] error in
print("Error: \(String(describing: error))")
if let source = error?["source"] as? String, source == "TimeoutException" {
print("Connection timed out. Restarting...")
self?.connection.start()
}
}
connection.start()
}
`
And for sending messages:
do { try chatHub.invoke(kRoom, arguments:[UserName!,text]) } catch { print(error) }
Please guide, where I am wrong. I am able to send messages, but not receiving.
Thanks!
I am using SwiftR V2_2_0 with XCode 9.4.1. The problem is Hub.invoke method is getting called but in other device Hub.on method is not getting called. I have checked for the connection and Connection State is showing as Connected, And also I can able to log Connection ID for both the devices.
I tried to log the error, but it was not showing in console.
I am using CocoaPods to install this using -> pod 'SwiftR'
Please advise me.