-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tomasz Janicki
committed
Aug 3, 2023
1 parent
85de844
commit e939795
Showing
2 changed files
with
10 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
using System.Net; | ||
using System.Net.WebSockets; | ||
using System.Net.WebSockets; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace Consumer.RealTime.Services; | ||
|
||
public sealed class ClientWebSocketWrapperFactory : IClientWebSocketWrapperFactory | ||
{ | ||
private readonly ICredentials _credentials; | ||
private readonly TimeSpan _monitorDelay; | ||
private readonly Uri _uri; | ||
|
||
public ClientWebSocketWrapperFactory(IOptions<ConfigurationSettings> options) | ||
{ | ||
_credentials = new NetworkCredential(options.Value.UserName, options.Value.Password); | ||
_monitorDelay = options.Value.WebSocketClientMonitorInterval; | ||
_uri = options.Value.ApiUri; | ||
} | ||
|
||
public IClientWebSocketWrapper GetNewInstance<TParam>(ILogger logger, Func<byte[], TParam, CancellationToken, Task> dataHandler, | ||
Func<WebSocketState, TParam, CancellationToken, Task> monitorHandler, TParam param) => | ||
new ClientWebSocketWrapper<TParam>(_credentials, _uri, logger, _monitorDelay, dataHandler, monitorHandler, param); | ||
new ClientWebSocketWrapper<TParam>(_uri, logger, _monitorDelay, dataHandler, monitorHandler, param); | ||
} |