Esempio n. 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);
        }
Esempio n. 2
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.Closed          += WebSocket_Closed;
            webSocketFeed.Error           += WebSocket_Error;
            webSocketFeed.MessageReceived += WebSocket_MessageReceived;
            webSocketFeed.Opened          += WebSocket_Opened;
            webSocketFeed.Open();
        }
Esempio n. 3
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);
        }