protected WebsocketClientBase(IWebsocketLiteClient websocketLiteClient, ILogger?logger = null) { LiteClient = websocketLiteClient; _logger = logger ?? NullLogger.Instance; AutoReopenThrottleTimeSpan = DefaultAutoReopenThrottle; OpenTimeout = DefaultOpenTimeout; CloseTimeout = DefaultCloseTimeout; KeepAliveTimeout = DefaultKeepAliveTimeout; _msgQueue = new BroadcastBlock <MessageEventArgs>(args => args); var rxAct = new ActionBlock <MessageEventArgs>(args => _messageSubject.OnNext(args)); var eventAct = new ActionBlock <MessageEventArgs>(args => MessageReceived?.Invoke(this, args)); _msgQueue.LinkTo(rxAct); _msgQueue.LinkTo(eventAct); State = ReadyState.Closed; LiteClient.Closed += WebsocketLiteClientOnClosed; LiteClient.Error += WebsocketLiteClientOnError; LiteClient.MessageReceived += WebsocketLiteClientOnMessageReceived; _reopenWatcher = new ReopenWatcher(this, _logger); }
protected DefaultWebsocketClient(IWebsocketLiteClient websocketLiteClient, ILogger?logger = null) : base( websocketLiteClient, logger) { }
public TestWebsocketClient(IWebsocketLiteClient websocketLiteClient, ILogger logger) : base(websocketLiteClient, logger) { }