Skip to content

Commit 311e3e0

Browse files
Change injection method of logger into IHttpClientService (#249)
* Change injection method of logger into IHttpClientService * Cleanup PubNubUnity.csproj, make PNConfiguration Logger setter internal * Add more details to SubscribeMabnager2 ReceiveRequest error log
1 parent 3094f66 commit 311e3e0

File tree

12 files changed

+51
-203
lines changed

12 files changed

+51
-203
lines changed

.pubnub.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
name: c-sharp
2-
version: "7.3.8"
2+
version: "7.3.9"
33
schema: 1
44
scm: github.com/pubnub/c-sharp
55
changelog:
6+
- date: 2025-05-09
7+
version: v7.3.9
8+
changes:
9+
- type: improvement
10+
text: "Changed the way the PubNub logger is injected into IHtttpClientService for better custom-transport-layers handling."
611
- date: 2025-04-08
712
version: v7.3.8
813
changes:
@@ -887,7 +892,7 @@ features:
887892
- QUERY-PARAM
888893
supported-platforms:
889894
-
890-
version: Pubnub 'C#' 7.3.8
895+
version: Pubnub 'C#' 7.3.9
891896
platforms:
892897
- Windows 10 and up
893898
- Windows Server 2008 and up
@@ -898,7 +903,7 @@ supported-platforms:
898903
- .Net Framework 4.6.1+
899904
- .Net Framework 6.0
900905
-
901-
version: PubnubPCL 'C#' 7.3.8
906+
version: PubnubPCL 'C#' 7.3.9
902907
platforms:
903908
- Xamarin.Android
904909
- Xamarin.iOS
@@ -918,7 +923,7 @@ supported-platforms:
918923
- .Net Core
919924
- .Net 6.0
920925
-
921-
version: PubnubUWP 'C#' 7.3.8
926+
version: PubnubUWP 'C#' 7.3.9
922927
platforms:
923928
- Windows Phone 10
924929
- Universal Windows Apps
@@ -942,7 +947,7 @@ sdks:
942947
distribution-type: source
943948
distribution-repository: GitHub
944949
package-name: Pubnub
945-
location: https://github.com/pubnub/c-sharp/releases/tag/v7.3.8.0
950+
location: https://github.com/pubnub/c-sharp/releases/tag/v7.3.9.0
946951
requires:
947952
-
948953
name: ".Net"
@@ -1225,7 +1230,7 @@ sdks:
12251230
distribution-type: source
12261231
distribution-repository: GitHub
12271232
package-name: PubNubPCL
1228-
location: https://github.com/pubnub/c-sharp/releases/tag/v7.3.8.0
1233+
location: https://github.com/pubnub/c-sharp/releases/tag/v7.3.9.0
12291234
requires:
12301235
-
12311236
name: ".Net Core"
@@ -1584,7 +1589,7 @@ sdks:
15841589
distribution-type: source
15851590
distribution-repository: GitHub
15861591
package-name: PubnubUWP
1587-
location: https://github.com/pubnub/c-sharp/releases/tag/v7.3.8.0
1592+
location: https://github.com/pubnub/c-sharp/releases/tag/v7.3.9.0
15881593
requires:
15891594
-
15901595
name: "Universal Windows Platform Development"

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
v7.3.9 - May 09 2025
2+
-----------------------------
3+
- Modified: changed the way the PubNub logger is injected into IHtttpClientService for better custom-transport-layers handling.
4+
15
v7.3.8 - April 08 2025
26
-----------------------------
37
- Modified: subscribe with custom timetoken scenario handling improvements.

src/Api/PubnubApi/EndPoint/PubSub/SubscribeManager2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ internal async Task<Tuple<ReceivingResponse<object>, PNStatus>> ReceiveRequest<T
120120
} catch (Exception ex)
121121
{
122122
logger?.Error(
123-
$" Receiving effect exception for \n channel(s)={string.Join(",", channels.OrderBy(x => x).ToArray())} \n cg(s)={string.Join(",", channelGroups.OrderBy(x => x).ToArray())} \n Exception Details={ex}");
123+
$" Receiving effect exception for \n channel(s)={string.Join(",", channels.OrderBy(x => x).ToArray())} \n cg(s)={string.Join(",", channelGroups.OrderBy(x => x).ToArray())} \n Exception Details={ex} \n Stack trace={ex.StackTrace}");
124124
}
125125
return resp;
126126
}

src/Api/PubnubApi/PNConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public CryptoModule CryptoModule
9393
}
9494
}
9595

96-
public PubnubLogModule Logger { get; set; }
96+
public PubnubLogModule Logger { get; internal set; }
9797

9898
public string AuthKey
9999
{

src/Api/PubnubApi/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
[assembly: AssemblyProduct("Pubnub C# SDK")]
1212
[assembly: AssemblyCopyright("Copyright © 2021")]
1313
[assembly: AssemblyTrademark("")]
14-
[assembly: AssemblyVersion("7.3.8.0")]
15-
[assembly: AssemblyFileVersion("7.3.8.0")]
14+
[assembly: AssemblyVersion("7.3.9.0")]
15+
[assembly: AssemblyFileVersion("7.3.9.0")]
1616
// Setting ComVisible to false makes the types in this assembly not visible
1717
// to COM components. If you need to access a type in this assembly from
1818
// COM, set the ComVisible attribute to true on that type.

src/Api/PubnubApi/Pubnub.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,8 @@ public Pubnub(PNConfiguration config, IHttpClientService httpTransportService =
12271227
//Defaulting to DotNet PNSDK source if no custom one is specified
12281228
Version = (ipnsdkSource == default) ? new DotNetPNSDKSource().GetPNSDK() : ipnsdkSource.GetPNSDK();
12291229
IHttpClientService httpClientService =
1230-
httpTransportService ?? new HttpClientService(proxy: config.Proxy, configuration: config);
1230+
httpTransportService ?? new HttpClientService(proxy: config.Proxy);
1231+
httpClientService.SetLogger(logger);
12311232
transportMiddleware = middleware ?? new Middleware(httpClientService, config, this, tokenManager);
12321233
logger?.Debug(GetConfigurationLogString(config));
12331234
}

src/Api/PubnubApi/PubnubApi.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
<PropertyGroup>
1616
<PackageId>Pubnub</PackageId>
17-
<PackageVersion>7.3.8.0</PackageVersion>
17+
<PackageVersion>7.3.9.0</PackageVersion>
1818
<Title>PubNub C# .NET - Web Data Push API</Title>
1919
<Authors>Pandu Masabathula</Authors>
2020
<Owners>PubNub</Owners>
2121
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
2222
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
2323
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
2424
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
25-
<PackageReleaseNotes>Subscribe with custom timetoken scenario handling improvements.</PackageReleaseNotes>
25+
<PackageReleaseNotes>Changed the way the PubNub logger is injected into IHtttpClientService for better custom-transport-layers handling.</PackageReleaseNotes>
2626
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
2727
<!--<Summary>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</Summary>-->
2828
<Description>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</Description>

src/Api/PubnubApi/Transport/HttpClientService.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,26 @@ namespace PubnubApi
1111
public class HttpClientService : IHttpClientService
1212
{
1313
private readonly HttpClient httpClient;
14-
private readonly PubnubLogModule logger;
14+
private PubnubLogModule logger;
1515

16-
public HttpClientService(IWebProxy proxy, PNConfiguration configuration)
16+
public HttpClientService(IWebProxy proxy)
1717
{
18-
logger = configuration.Logger;
19-
20-
var handler = new HttpClientHandler
21-
{
22-
MaxConnectionsPerServer = 50,
23-
UseProxy = proxy != null,
24-
Proxy = proxy
25-
};
26-
27-
httpClient = new HttpClient(handler)
18+
httpClient = new HttpClient()
2819
{
2920
Timeout = Timeout.InfiniteTimeSpan
3021
};
22+
if (proxy == null) return;
23+
httpClient = new HttpClient(new HttpClientHandler()
24+
{
25+
Proxy = proxy,
26+
UseProxy = true
27+
});
28+
httpClient.Timeout = Timeout.InfiniteTimeSpan;
29+
}
30+
31+
public void SetLogger(PubnubLogModule logger)
32+
{
33+
this.logger = logger;
3134
}
3235

3336
public async Task<TransportResponse> GetRequest(TransportRequest transportRequest)

src/Api/PubnubApi/TransportContract/IHttpClientService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ public interface IHttpClientService
99
Task<TransportResponse> PostRequest(TransportRequest transportRequest);
1010
Task<TransportResponse> PatchRequest(TransportRequest transportRequest);
1111
Task<TransportResponse> PutRequest(TransportRequest transportRequest);
12+
void SetLogger(PubnubLogModule logger);
1213
}
1314
}

src/Api/PubnubApiPCL/PubnubApiPCL.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
<PropertyGroup>
1616
<PackageId>PubnubPCL</PackageId>
17-
<PackageVersion>7.3.8.0</PackageVersion>
17+
<PackageVersion>7.3.9.0</PackageVersion>
1818
<Title>PubNub C# .NET - Web Data Push API</Title>
1919
<Authors>Pandu Masabathula</Authors>
2020
<Owners>PubNub</Owners>
2121
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
2222
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
2323
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
2424
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
25-
<PackageReleaseNotes>Subscribe with custom timetoken scenario handling improvements.</PackageReleaseNotes>
25+
<PackageReleaseNotes>Changed the way the PubNub logger is injected into IHtttpClientService for better custom-transport-layers handling.</PackageReleaseNotes>
2626
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
2727
<!--<Summary>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</Summary>-->
2828
<Description>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</Description>

0 commit comments

Comments
 (0)