Reputation: 2202
I have Developed a WebApi Backend Project on .NET CORE 2.1.403 and all the webapi routes are working great. Now I have a requirement for a real-time update on iOS application developed in Swift.
I could not find any official library which supports SignalR. After searching I found out https://github.com/moozzyk/SignalR-Client-Swift which supports .NET CORE
but there is no detailed documentation on which we can rely. However my Javascript client is working great with .NET CORE.
I have previously used SwiftR with .NET FRAMEWORK 4.7.1
SignalR and it worked fine.
As suggested on GITHUB issue there is no plan on a Swift client. Any suggestions in this regards would be helpful.
Upvotes: 6
Views: 2968
Reputation: 76
I realize this is a late reply, but for what it's worth, I've successfully used the https://github.com/moozzyk/SignalR-Client-Swift SignalR client in iOS, against an AspNet Core server implementation. The documentation on GitHub is a little sparse, but it is very simple to use. For example:
// Set up a connection to the SignalR hub on the servver.
private func connectToSignalRHub() {
// Are we already connected to the hub?
if !isHubConnected {
let url = URL(string: "http://\(hostName):\(serverPort)/hub")!
hubConnection = HubConnectionBuilder(url: url).withLogging(minLogLevel: .error).build()
if let hub = hubConnection {
hub.delegate = self
// Set our callbacks for the messages we expect from the SignalR hub.
hub.on(method: "ProgressUpdate", callback: {
args, typeConverter in
if let data = try? typeConverter.convertFromWireType(obj: args[0], targetType: String.self) {
self.onHubProgressUpdate(progress: data)
}
})
// Start the hub connection.
hub.start()
}
}
}
I'd be happy to share more details if you still need it.
Upvotes: 5