     }
     
     public func createHubProxy(name: String) -> Hub {
-        let hub = Hub(name: name, swiftR: self)
+        let hub = Hub(name: name, signalR: self)
         hubs[name.lowercaseString] = hub
         return hub
     }

import Foundation
import WebKit

public class SwiftR: NSObject, WKScriptMessageHandler {

    var webView: WKWebView!
    var url: String!
    
    var readyHandler: ((SwiftR) -> ())!
    var hubs = [String: Hub]()
    
    public class func connect(url: String, readyHandler: (SwiftR) -> ()) -> SwiftR {
        return SwiftR(url: url, readyHandler: readyHandler)
    }
    
    init(url: String, readyHandler: (SwiftR) -> ()) {
        super.init()
        
        self.url = url

        
        let params = ",".join(jsonParams)
        let js = "\(name).invoke('\(method)', \(params))"
        signalR.webView.evaluateJavaScript(js, completionHandler: nil)
    }
    
    func ensureHub() {
        let js = "if (typeof \(name) == 'undefined') \(name) = connection.createHubProxy('\(name)')"
        signalR.webView.evaluateJavaScript(js, completionHandler: nil)
    }
}

