2019-02-28 16:44:50 +08:00
|
|
|
|
using Bootstrap.Admin;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.Extensions.DependencyInjection
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class OnlineUsersServicesCollectionExtensions
|
|
|
|
|
{
|
2019-03-02 15:15:47 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal const string IPSvrHttpClientName = "IPSvr";
|
|
|
|
|
|
2019-02-28 16:44:50 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="services"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static IServiceCollection AddOnlineUsers(this IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
services.TryAddSingleton<IOnlineUsers, DefaultOnlineUsers>();
|
2019-03-02 15:15:47 +08:00
|
|
|
|
services.AddHttpClient(IPSvrHttpClientName, client =>
|
|
|
|
|
{
|
|
|
|
|
client.DefaultRequestHeaders.Connection.Add("keep-alive");
|
|
|
|
|
});
|
2019-02-28 16:44:50 +08:00
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|