예제 #1
0
 public SlackRtmClient(string token)
 {
     _jsonSettings = Default.JsonSettings(Default.SlackTypeResolver(Default.AssembliesContainingSlackTypes));
     _client       = new SlackApiClient(Default.Http(_jsonSettings), Default.UrlBuilder(_jsonSettings), _jsonSettings, token);
     _webSocket    = new ReconnectingWebSocket(Default.WebSocketFactory, Scheduler.Default, Default.Logger, 0);
     _rawEvents    = DeserializeEvents(_webSocket, _jsonSettings);
 }
예제 #2
0
 public SlackRtmClient(ISlackApiClient client, IWebSocketFactory webSocketFactory, SlackJsonSettings jsonSettings, IScheduler scheduler, ILogger logger)
 {
     _client       = client;
     _jsonSettings = jsonSettings;
     _webSocket    = new ReconnectingWebSocket(webSocketFactory, scheduler, logger, 0);
     _rawEvents    = DeserializeEvents(_webSocket, _jsonSettings);
 }
예제 #3
0
 private static IObservable <Event> DeserializeEvents(ReconnectingWebSocket webSocket, SlackJsonSettings jsonSettings) =>
 webSocket.Messages
 .Select(m => JsonConvert.DeserializeObject <Event>(m.Message, jsonSettings.SerializerSettings))
 .Publish()
 .RefCount();