コード例 #1
0
        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);
        }
コード例 #2
0
 protected DefaultWebsocketClient(IWebsocketLiteClient websocketLiteClient, ILogger?logger = null) : base(
         websocketLiteClient, logger)
 {
 }
コード例 #3
0
 public TestWebsocketClient(IWebsocketLiteClient websocketLiteClient, ILogger logger) : base(websocketLiteClient,
                                                                                             logger)
 {
 }