Skip to content

Commit

Permalink
Merge pull request #143 from kaizendevsio/Development/Main
Browse files Browse the repository at this point in the history
Development/main
  • Loading branch information
kaizendevsio authored Jun 30, 2024
2 parents 8a18bbb + f920689 commit 073ba67
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,23 @@ private void InitializeService()
_logger.LogWarning("StreamFlow configuration is not set, therefore SignalR client service is disabled");
return;
}


var serverUrl = StreamFlowConfiguration?.ServerUrls?.FirstOrDefault() ?? new Uri(envConfig);
Connection = new HubConnectionBuilder()
.WithUrl(StreamFlowConfiguration?.ServerUrls?.FirstOrDefault() ?? new Uri(envConfig))
.WithUrl(serverUrl, (opts) =>
{
if (serverUrl.AbsoluteUri.StartsWith("https://localhost", StringComparison.OrdinalIgnoreCase)
|| serverUrl.AbsoluteUri.StartsWith("https://127.0.0.1", StringComparison.OrdinalIgnoreCase))
{
opts.HttpMessageHandlerFactory = (message) =>
{
if (message is HttpClientHandler clientHandler)
// always verify the SSL certificate
clientHandler.ServerCertificateCustomValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
return message;
};
}
})
.WithAutomaticReconnect(Enumerable.Repeat(TimeSpan.FromSeconds(2), 2000).ToArray())
.AddMessagePackProtocol()
.Build();
Expand Down

0 comments on commit 073ba67

Please sign in to comment.