private IDisposable Subscribe(object handler, MethodInfo method, IHubConnection connection) { var args = method.GetParameters().Select(p => p.ParameterType).ToArray(); var state = new HandlerState(method, handler); var handlerFunc = HandlerForMethod(method); return(connection.On(method.Name, args, handlerFunc, state)); }