GithubHelp home page GithubHelp logo

Comments (7)

adamhartford avatar adamhartford commented on August 19, 2024

I've only been using the Xcode 7 beta for trying Swift 2 and iOS 9. (SwiftR is not yet updated for either.) I'm guessing you're targeting iOS 8 in Xcode 7. If so, how? I'm able to install the iOS 8 simulator, but not select it as the base SDK for my targets. If you can help me with that, I can probably help you.

As an aside: do you have any issues in Xcode 6?

from swiftr.

jackyheart avatar jackyheart commented on August 19, 2024

Hi Adam, yup, I'm targetting iOS8 in XCode 7. I'm able to run it on simulator, but I don't get any callbacks on 'on' & 'invoke'.

I've just tried on XCode 6, same thing, no callback.

Btw, how do you get the callback result on 'invoke' ? There's no callback block/closure on the 'invoke' method.

I've also tried the SignalR Obj-C version with XCode6, but the 'on' function doesn't return as well... It stops here: [SERVER_SENT_EVENTS] SSE: GET /signalr/signalr/connect.

from swiftr.

adamhartford avatar adamhartford commented on August 19, 2024

You won't get a callback on invoke. That method invokes a SignlaR server-side method, which in turn invokes your on callback. See the SwifR demo application as an example.

// 1. Client: Inovkes SendComplex on SignalR server
complexHub.invoke("sendComplex", arguments: [message])
// 2. Server: Invokes notifyComplex on connected clients
public void SendComplex(ComplexMessage message) 
{
    Clients.All.notifyComplex (message);
}
// 3. Client: handler method invoked as result of step 2
self?.complexHub.on("notifyComplex") { args in
   let m: AnyObject = args!["0"] as AnyObject!
   println(m)
}

Normally, you might have many clients listening for notifyComplex. Think of an example where you have many iOS clients connected to a SignalR server for sync. One of your devices tells SignalR that data needs to be updated. SignalR tells your other iOS (or web, Android, whatever) clients.

In order to help, I'd need to see both your iOS client and SignalR server code. Do you have other clients already working properly with your SignalR server?

from swiftr.

jackyheart avatar jackyheart commented on August 19, 2024

Hi Adam, it's working on 'on' now (XCode6 - Swift). Is there a connection id like the javascript or Android version ?

from swiftr.

adamhartford avatar adamhartford commented on August 19, 2024

Cool. No, there is no way to access the connection ID right now, just because I haven't needed it in my own use. I can add it though if it'll help you.

from swiftr.

jackyheart avatar jackyheart commented on August 19, 2024

Hi Adam, oh I see. Nvm, I can get it from the server instead. Thx !

from swiftr.

adamhartford avatar adamhartford commented on August 19, 2024

You're welcome! FYI, I did make a change to provide the connection ID anyway in commit d561fdd. The demo application shows how to get it.

from swiftr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.