Comments (6)
Hi, I'll need some more information to help. Can you post some of your client code? In general, you should have something like this:
SwiftR.connect("http://yourserver.com") { connection in
self?.complexHub = connection.createHubProxy("complexHub")
self?.complexHub.on("notifyComplex") { args in
let m: AnyObject = args!["0"] as AnyObject!
print(m)
}
}
from swiftr.
I need some method like SignalR-objc method,like below code
renderHub?.invoke("hello", withArgs: renderArgs, completionHandler: { (response, error) -> Void in
print("(response)")
})
thank you
from swiftr.
OK, I see. I haven't added support for invoke
return values yet. I agree that this would be nice to have. I'll work on it next.
from swiftr.
Commit fb4fdce adds this support. The invoke signature is now:
public func invoke(method: String, arguments: [AnyObject]?, callback: ((AnyObject?, String?) -> ())? = nil)
Here's an example usage:
simpleHub.invoke("sendSimple", arguments: ["Simple Test", "This is a simple message"]) { (result, error) in
if let e = error {
print("Error message: \(e)")
} else {
print("Success!")
if let r = result {
print("Result: \(r)")
}
}
}
from swiftr.
Thank you!
from swiftr.
Change is included in v0.8.1.
from swiftr.
Related Issues (20)
- "There was an error invoking Hub" Swift 4 HOT 5
- My signalR connection is established but can not invoke the hub function.
- hub.invoke(...) Won't handle any response.
- SignalR 1.0.0-preview2-final in .NET core?
- SwiftR 0.14.0 is not connecting with server using Xcode 9.3, Swift 4.1 and iOS 11.3 HOT 3
- dyld: Library not loaded: @rpath/SwiftR.framework/SwiftR
- Spelling issue
- Hub.on is not getting called after establishing connection HOT 1
- How to remove registed hub in hubs
- How can i upgrade from v2.2 to v2.4?
- Close a persistent connection
- loging connection information
- How to remove event from chathub?
- Xcode 10 can't run in swift 4 HOT 5
- Mac Catalyst support! HOT 3
- UIWebView deprecated from iOS 13 HOT 1
- UIWebView deprecated HOT 9
- not supporting latest iOS . please make it compatible for swift 5 and iOS 15.
- Solved UIWebView deprecated and Swift 5 compatibility
- Remove the listener of .on method
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftr.