 public class Hub {
     let name: String
     var handlers: [String: AnyObject? -> ()] = [:]
+    var invokeHandlers: [String: (AnyObject?, String?) -> ()] = [:]
     
     public let connection: SignalR!
     

            }
        }
        
        let args = jsonArguments.joinWithSeparator(",")
        let js = "swiftR.hubs.\(name).invoke('\(method)', \(args))"
        
        connection.runJavaScript(js)
    }

            case "reconnected":
                state = .Connected
                reconnected?()
            case "invokeHandler":
                let hubName = json["hub"] as! String
                if let hub = hubs[hubName] {
                    let uuid = json["id"] as! String
                    let result = json["result"]
                    let error = json["error"] as? String
                    if let callback = hub.invokeHandlers[uuid] {
                        callback(result, error)
                        hub.invokeHandlers.removeValueForKey(uuid)
                    }
                }
            case "error":
                if let err: AnyObject = json["error"] {
                    error?(err["context"])
