     }
     
     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
     }

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


    
    var handlers: [String: AnyObject? -> ()] = [:]
    
    let signalR: SignalR!
    
    init(name: String, signalR: SignalR) {
        self.name = name
        self.signalR = signalR
    }
    
    public func on(method: String, handler: (AnyObject? -> ())?) {
        ensureHub()
        handlers[method] = handler
        signalR.webView.evaluateJavaScript("addHandler(\(name), '\(method)')", completionHandler: nil)
    }
    
    public func invoke(method: String, parameters: [AnyObject]?) {
