-
Notifications
You must be signed in to change notification settings - Fork 60
Description
Hi
I am developing conversation section in my app in swift. I am trying to connect to hub connection but I am getting this error
2018-11-09 10:43:49.567342+0500 smithandersen[17603:268382] Task <C8744AE8-CB39-4AE6-A1D4-0CE765DFC52A>.<2> finished with error - code: -1002 2018-11-09 10:43:49.587491+0500 smithandersen[17603:268392] Task <C8744AE8-CB39-4AE6-A1D4-0CE765DFC52A>.<2> load failed with error Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSLocalizedDescription=unsupported URL, NSErrorFailingURLStringKey=ws://192.168.0.116:80/signalr/connect?connectionData=%5B%7B%22Name%22%3A%22chathub%22%7D%5D&connectionToken=jaoYVy%2BXP4Tzqn1n03ykwoylUlGJpJDcLMd8GyenOc0VlHaauMMB5SVmwWfONClS4GWEWl7fp2hyfd6vU25l3aAYc/iibhF9OznldYJewhwXarrzOlkL%2B%2B4YXUpIXAiw&groupsToken=&messageId=&transport=webSockets, NSErrorFailingURLKey=ws://192.168.0.116:80/signalr/connect?connectionData=%5B%7B%22Name%22%3A%22chathub%22%7D%5D&connectionToken=jaoYVy%2BXP4Tzqn1n03ykwoylUlGJpJDcLMd8GyenOc0VlHaauMMB5SVmwWfONClS4GWEWl7fp2hyfd6vU25l3aAYc/iibhF9OznldYJewhwXarrzOlkL%2B%2B4YXUpIXAiw&groupsToken=&messageId=&transport=webSockets, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <C8744AE8-CB39-4AE6-A1D4-0CE765DFC52A>.<2>" ), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <C8744AE8-CB39-4AE6-A1D4-0CE765DFC52A>.<2>, NSUnderlyingError=0x600001d1a760 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 "(null)"}} [-1002] startedOptional("19aef1e2-31e1-49d8-994c-04ab66545269")
my code so far
`
connection = HubConnection(withUrl: "http://192.168.0.116:80")
connection.connectionToken = AppSettings.getAPICookieValue()!
connection.addValue(value: "Mobile", forHttpHeaderField: "Device")
chatHub = self.connection.createHubProxy(hubName: "ChatHub")
_ = chatHub.on(eventName: "newMessage") { (args) in
print("MyChatHub listening...")
let message = args[0] as! String
let detail = args[1] as! String
print("Message: \(message) \nDetail: \(detail)")
}
connection.started = { [unowned self] in
print("started\(self.connection.connectionId)")
}
connection.reconnecting = { [unowned self] in
print("Reconnecting....")
}
connection.reconnected = { [unowned self] in
print("Reconnected. Connection ID: \(self.connection.connectionId!)")
}
connection.connectionSlow = { print("Connection slow...") }
connection.error = { error in
print("Error: \(error)")
}
connection.start()
`
eagerly waiting for help