From fe68c35cb04f5be44cc390012d99f20e82a7e754 Mon Sep 17 00:00:00 2001 From: "PUBNUB\\jakub.grzesiowski" Date: Thu, 10 Apr 2025 11:19:25 +0200 Subject: [PATCH 1/5] Change injection method of logger into IHttpClientService --- src/Api/PubnubApi/Pubnub.cs | 3 ++- src/Api/PubnubApi/Transport/HttpClientService.cs | 11 +++++++---- .../PubnubApi/TransportContract/IHttpClientService.cs | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Api/PubnubApi/Pubnub.cs b/src/Api/PubnubApi/Pubnub.cs index 736889e4c..f860f2bec 100644 --- a/src/Api/PubnubApi/Pubnub.cs +++ b/src/Api/PubnubApi/Pubnub.cs @@ -1227,7 +1227,8 @@ public Pubnub(PNConfiguration config, IHttpClientService httpTransportService = //Defaulting to DotNet PNSDK source if no custom one is specified Version = (ipnsdkSource == default) ? new DotNetPNSDKSource().GetPNSDK() : ipnsdkSource.GetPNSDK(); IHttpClientService httpClientService = - httpTransportService ?? new HttpClientService(proxy: config.Proxy, configuration: config); + httpTransportService ?? new HttpClientService(proxy: config.Proxy); + httpClientService.SetLogger(logger); transportMiddleware = middleware ?? new Middleware(httpClientService, config, this, tokenManager); logger?.Debug(GetConfigurationLogString(config)); } diff --git a/src/Api/PubnubApi/Transport/HttpClientService.cs b/src/Api/PubnubApi/Transport/HttpClientService.cs index e51a255b8..b4aa526fa 100644 --- a/src/Api/PubnubApi/Transport/HttpClientService.cs +++ b/src/Api/PubnubApi/Transport/HttpClientService.cs @@ -11,12 +11,10 @@ namespace PubnubApi public class HttpClientService : IHttpClientService { private readonly HttpClient httpClient; - private readonly PubnubLogModule logger; + private PubnubLogModule logger; - public HttpClientService(IWebProxy proxy, PNConfiguration configuration) + public HttpClientService(IWebProxy proxy) { - logger = configuration.Logger; - var handler = new HttpClientHandler { MaxConnectionsPerServer = 50, @@ -30,6 +28,11 @@ public HttpClientService(IWebProxy proxy, PNConfiguration configuration) }; } + public void SetLogger(PubnubLogModule logger) + { + this.logger = logger; + } + public async Task GetRequest(TransportRequest transportRequest) { TransportResponse transportResponse; diff --git a/src/Api/PubnubApi/TransportContract/IHttpClientService.cs b/src/Api/PubnubApi/TransportContract/IHttpClientService.cs index a86a2c01e..8c1b415e4 100644 --- a/src/Api/PubnubApi/TransportContract/IHttpClientService.cs +++ b/src/Api/PubnubApi/TransportContract/IHttpClientService.cs @@ -9,5 +9,6 @@ public interface IHttpClientService Task PostRequest(TransportRequest transportRequest); Task PatchRequest(TransportRequest transportRequest); Task PutRequest(TransportRequest transportRequest); + void SetLogger(PubnubLogModule logger); } } \ No newline at end of file From cc527c26dcfeffd4669f8db7af3e4ef7bdb8f349 Mon Sep 17 00:00:00 2001 From: "PUBNUB\\jakub.grzesiowski" Date: Mon, 14 Apr 2025 10:16:01 +0200 Subject: [PATCH 2/5] Cleanup PubNubUnity.csproj, make PNConfiguration Logger setter internal --- src/Api/PubnubApi/PNConfiguration.cs | 2 +- src/Api/PubnubApiUnity/PubnubApiUnity.csproj | 178 +------------------ 2 files changed, 7 insertions(+), 173 deletions(-) diff --git a/src/Api/PubnubApi/PNConfiguration.cs b/src/Api/PubnubApi/PNConfiguration.cs index f9b494ae9..45044d967 100644 --- a/src/Api/PubnubApi/PNConfiguration.cs +++ b/src/Api/PubnubApi/PNConfiguration.cs @@ -93,7 +93,7 @@ public CryptoModule CryptoModule } } - public PubnubLogModule Logger { get; set; } + public PubnubLogModule Logger { get; internal set; } public string AuthKey { diff --git a/src/Api/PubnubApiUnity/PubnubApiUnity.csproj b/src/Api/PubnubApiUnity/PubnubApiUnity.csproj index 4ee23836d..09fe426bd 100644 --- a/src/Api/PubnubApiUnity/PubnubApiUnity.csproj +++ b/src/Api/PubnubApiUnity/PubnubApiUnity.csproj @@ -2,6 +2,7 @@ net6.0;netstandard2.0 + true default True pubnub.snk @@ -671,178 +672,6 @@ - - - - None - - - - - - - - None - - - None - - - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - - - - - None - - - None - - - - - None - - - None - - - None - - - None - - - None - - - - - - - None - - - None - - - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - - - - - None - - - None - - - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - - None - - @@ -886,6 +715,11 @@ + + + + + PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously diff --git a/src/Api/PubnubApiPCL/PubnubApiPCL.csproj b/src/Api/PubnubApiPCL/PubnubApiPCL.csproj index 194c5985d..2c393afe2 100644 --- a/src/Api/PubnubApiPCL/PubnubApiPCL.csproj +++ b/src/Api/PubnubApiPCL/PubnubApiPCL.csproj @@ -14,7 +14,7 @@ PubnubPCL - 7.3.8.0 + 7.3.9.0 PubNub C# .NET - Web Data Push API Pandu Masabathula PubNub @@ -22,7 +22,7 @@ http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png true https://github.com/pubnub/c-sharp/ - Subscribe with custom timetoken scenario handling improvements. + Changed the way the PubNub logger is injected into IHtttpClientService for better custom-transport-layers handling. Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously diff --git a/src/Api/PubnubApiUWP/PubnubApiUWP.csproj b/src/Api/PubnubApiUWP/PubnubApiUWP.csproj index 7d6153e95..175510af0 100644 --- a/src/Api/PubnubApiUWP/PubnubApiUWP.csproj +++ b/src/Api/PubnubApiUWP/PubnubApiUWP.csproj @@ -16,7 +16,7 @@ PubnubUWP - 7.3.8.0 + 7.3.9.0 PubNub C# .NET - Web Data Push API Pandu Masabathula PubNub @@ -24,7 +24,7 @@ http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png true https://github.com/pubnub/c-sharp/ - Subscribe with custom timetoken scenario handling improvements. + Changed the way the PubNub logger is injected into IHtttpClientService for better custom-transport-layers handling. Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously diff --git a/src/Api/PubnubApiUnity/PubnubApiUnity.csproj b/src/Api/PubnubApiUnity/PubnubApiUnity.csproj index 09fe426bd..d0dc9b825 100644 --- a/src/Api/PubnubApiUnity/PubnubApiUnity.csproj +++ b/src/Api/PubnubApiUnity/PubnubApiUnity.csproj @@ -15,7 +15,7 @@ PubnubApiUnity - 7.3.8.0 + 7.3.9.0 PubNub C# .NET - Web Data Push API Pandu Masabathula PubNub