@@ -24,17 +24,22 @@ public static IServiceProvider BuildServiceProvider(IServiceCollection services,
2424 services . AddSingleton < IDecapsulable , Decapsulator > ( ) ;
2525 services . AddSingleton < IHttpClient , SystemHttpClient > ( ) ;
2626 services . AddSingleton < IRetriable , RandomDelayRetryPolicy > ( ) ;
27- services . AddTransient < IHttpAdapter , HttpAdapter > ( ) ;
27+ services . AddScoped < IHttpAdapter , HttpAdapter > ( ) ;
2828 services . AddSingleton < IUriConverter > ( new DefaultUriConverter ( ) ) ;
2929
3030 // SystemTextJson or NewtonsoftJson
3131 // v3 or V4
3232 // Polling or WebSocket
3333 AddSystemTextJson ( services ) ;
3434
35- services . AddSingleton < IEngineIOAdapterFactory , EngineIOAdapterFactory > ( ) ;
35+ services . AddScoped < IEngineIOAdapterFactory , EngineIOAdapterFactory > ( ) ;
36+ services . AddKeyedScoped < IEngineIOAdapter , EngineIO3Adapter > ( EngineIO . V3 ) ;
37+ services . AddKeyedScoped < IEngineIOAdapter , EngineIO4Adapter > ( EngineIO . V4 ) ;
38+
39+ // TODO: Microsoft.Extensions.Http .AddHttpClient()
3640 services . AddSingleton < HttpMessageInvoker , HttpClient > ( ) ;
37- services . AddTransient < ISessionFactory , HttpSessionFactory > ( ) ;
41+ // services.AddScoped<ISessionFactory, HttpSessionFactory>();
42+ services . AddScoped < ISession , HttpSession > ( ) ;
3843
3944 configure ? . Invoke ( services ) ;
4045
@@ -46,6 +51,19 @@ private static void AddSystemTextJson(IServiceCollection services)
4651 services . AddKeyedSingleton < IEngineIOMessageAdapter , SystemJsonEngineIO3MessageAdapter > ( EngineIO . V3 ) ;
4752 services . AddKeyedSingleton < IEngineIOMessageAdapter , SystemJsonEngineIO4MessageAdapter > ( EngineIO . V4 ) ;
4853 services . AddSingleton < IEngineIOMessageAdapterFactory , EngineIOMessageAdapterFactory > ( ) ;
49- services . AddSingleton < ISerializerFactory , SystemJsonSerializerFactory > ( ) ;
54+ // TODO: Should be Scoped, need to add test cases to cover it
55+ services . AddSingleton < ISerializer , SystemJsonSerializer > ( ) ;
56+ }
57+ }
58+
59+ public record ProtocolOptions
60+ {
61+ public ProtocolOptions ( TransportProtocol protocol , EngineIO engineIO )
62+ {
63+ Protocol = protocol ;
64+ EngineIO = engineIO ;
5065 }
66+
67+ public TransportProtocol Protocol { get ; }
68+ public EngineIO EngineIO { get ; }
5169}
0 commit comments