private void SetupReceiver() { Task.Factory.StartNew(Setup); async void Setup() { try { while (webSocketManager.State == WebSocketState.Open) { var json = await webSocketManager.ReceiveData(); try { var response = rtmResponseFactory.CreateResponse(json); slackRtmEventPublisher.Fire(response); } catch (NotImplementedException e) { log.Error(e.Message); } finally { log.Debug(json); } } } catch (Exception ex) { slackConnectionEventPublisher.RaiseRtmDisconnected(); } } }
private void ParseConfig(IEnvConfigParser parser, IBashiConfigFile file) { var keyValuePairs = parser.Parse(file.ReadLines()); foreach (var keyValuePair in keyValuePairs) { switch (keyValuePair.Key) { case "SLACK_BOT_TOKEN": slackConfigGroup.BotToken = keyValuePair.Value; break; case "SLACK_PING_TIMEOUT": slackConfigGroup.PingTimeout = int.Parse(keyValuePair.Value); break; default: log.Error($"Unknown ConfigFile key '{keyValuePair.Key}'"); break; } } }