private IHub CreateHub(IRequest request, HubDescriptor descriptor, string connectionId, TrackingDictionary state = null, bool throwIfFailedToCreate = false) { try { var hub = _manager.ResolveHub(descriptor.Name); if (hub != null) { state = state ?? new TrackingDictionary(); hub.Context = new HubCallerContext(request, connectionId); hub.Caller = new StatefulSignalProxy(Connection, connectionId, descriptor.Name, state); hub.Clients = new ClientProxy(Connection, descriptor.Name); hub.Groups = new GroupManager(Connection, descriptor.Name); } return(hub); } catch (Exception ex) { Trace.TraceInformation("Error creating hub {0}. " + ex.Message, descriptor.Name); if (throwIfFailedToCreate) { throw; } return(null); } }