Beispiel #1
0
        public void Start(
            List <ProductType> productTypes,
            List <ChannelType> channelTypes = null,
            int?autoSendPingInterval        = null)
        {
            if (productTypes.Count == 0)
            {
                throw new ArgumentException($"You must specify at least one {nameof(productTypes)}");
            }

            stopWebSocket = false;

            this.productTypes = productTypes;
            this.channelTypes = channelTypes;

            webSocketFeed = createWebSocketFeed();

            if (autoSendPingInterval.HasValue && autoSendPingInterval >= 0)
            {
                AutoSendPingInterval = autoSendPingInterval;
            }

            if (AutoSendPingInterval.HasValue)
            {
                webSocketFeed.SetAutoSendPingInterval(AutoSendPingInterval.Value);
            }

            webSocketFeed.Closed          += WebSocket_Closed;
            webSocketFeed.Error           += WebSocket_Error;
            webSocketFeed.MessageReceived += WebSocket_MessageReceived;
            webSocketFeed.Opened          += WebSocket_Opened;
            webSocketFeed.Open();

            Log.Information("WebSocket started with {@ProductTypes} {@ChannelTypes}", this.productTypes, this.channelTypes);
        }
Beispiel #2
0
 public WebSocket(
     IWebSocketFeed webSocketFeed,
     IAuthenticator authenticator,
     IClock clock)
 {
     this.webSocketFeed = webSocketFeed;
     this.authenticator = authenticator;
     this.clock         = clock;
 }
Beispiel #3
0
        public void Start(
            List <ProductType> providedProductTypes,
            List <ChannelType> providedChannelTypes = null)
        {
            if (providedProductTypes.Count == 0)
            {
                throw new ArgumentException("You must specify at least one product type");
            }

            stopWebSocket = false;

            productTypes = providedProductTypes;
            channelTypes = providedChannelTypes;

            webSocketFeed                  = createWebSocketFeed();
            webSocketFeed.Closed          += WebSocket_Closed;
            webSocketFeed.Error           += WebSocket_Error;
            webSocketFeed.MessageReceived += WebSocket_MessageReceived;
            webSocketFeed.Opened          += WebSocket_Opened;
            webSocketFeed.Open();
        }
Beispiel #4
0
        public void Start(
            List <ProductType> productTypes,
            List <ChannelType> channelTypes = null)
        {
            if (productTypes.Count == 0)
            {
                throw new ArgumentException($"You must specify at least one {nameof(productTypes)}");
            }

            stopWebSocket = false;

            this.productTypes = productTypes;
            this.channelTypes = channelTypes;

            webSocketFeed                  = createWebSocketFeed();
            webSocketFeed.Closed          += WebSocket_Closed;
            webSocketFeed.Error           += WebSocket_Error;
            webSocketFeed.MessageReceived += WebSocket_MessageReceived;
            webSocketFeed.Opened          += WebSocket_Opened;
            webSocketFeed.Open();

            Log.Information("WebSocket started with {@ProductTypes} {@ChannelTypes}", this.productTypes, this.channelTypes);
        }