using Microsoft.AspNetCore.SignalR; using System; namespace NCC.InstantMessaging { /// /// 即时通信静态类 /// public static class IM { /// /// 获取集线器实例 /// /// /// /// public static IHubContext GetHub(IServiceProvider serviceProvider = default) where THub : Hub { return App.GetService>(serviceProvider); } /// /// 获取强类型集线器实例 /// /// /// /// /// public static IHubContext GetHub(IServiceProvider serviceProvider = default) where THub : Hub where TStronglyTyped : class { return App.GetService>(serviceProvider); } } }