Skip to content

Commit 1e1183a

Browse files
authored
Merge pull request #176 from coinapi/SDKConsoleApp
supress_hb bugfix
2 parents 582a594 + fb90d1d commit 1e1183a

File tree

1 file changed

+6
-4
lines changed
  • data-api/csharp-ws/CoinAPI.WebSocket.Stats.Console

1 file changed

+6
-4
lines changed

data-api/csharp-ws/CoinAPI.WebSocket.Stats.Console/Program.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static async Task Main(string[] args)
8383

8484
public async Task MakeRequest([FromService] IConfiguration configuration, string endpoint_name = "wss://ws.coinapi.io/",
8585
string subscribe_data_type = null, string asset = null, string symbol = null,
86-
string exchange = null, string apikey = null, string type = "hello", bool supress_hb = false, string latency_type = "ce")
86+
string exchange = null, string apikey = null, string type = "hello", string supress_hb = "false", string latency_type = "ce")
8787
{
8888
var typeNames = Enum.GetNames<SubType>().ToList();
8989
if (!typeNames.Any(x => x == subscribe_data_type))
@@ -115,10 +115,12 @@ public async Task MakeRequest([FromService] IConfiguration configuration, string
115115
Serilog.Log.Error($"Invalid latency_type, valid values: {string.Join(",", latencyTypes)}");
116116
return;
117117
}
118-
118+
bool.TryParse(supress_hb, out bool hb_supressed);
119+
119120
using (var wsClient = new CoinApiWsClient(endpoint_name))
120121
{
121-
wsClient.SupressHeartbeat(supress_hb);
122+
wsClient.SupressHeartbeat(hb_supressed);
123+
122124
LatencyType latencyType = Enum.GetValues<LatencyType>().FirstOrDefault(x => x.ToString() == latency_type);
123125

124126
wsClient.Error += WsClient_Error;
@@ -165,7 +167,7 @@ public async Task MakeRequest([FromService] IConfiguration configuration, string
165167
};
166168
wsClient.SendHelloMessage(hello);
167169

168-
_ = PrintingTaskLoopAsync(wsClient, endpoint_name, subscribe_data_type, asset, symbol, exchange, supress_hb, latency_type);
170+
_ = PrintingTaskLoopAsync(wsClient, endpoint_name, subscribe_data_type, asset, symbol, exchange, hb_supressed, latency_type);
169171

170172
await Task.Run(() => Console.ReadKey());
171173
}

0 commit comments

Comments
 (0)