Exemplo n.º 1
0
 public UserInfoApiResponse(
     string ok,
     string error,
     UserDto user)
     : base(ok, error)
 {
     User = user;
 }
Exemplo n.º 2
0
 public RtmStartApiResponse(
     string ok,
     string error,
     Uri url,
     UserDto self)
     : base(ok, error)
 {
     Url = url;
     Self = self;
 }
Exemplo n.º 3
0
        public async Task ConnectAsync(CancellationToken cancellationToken)
        {
            if (_cancellationTokenSource.IsCancellationRequested)
            {
                return;
            }

            using (await _asyncLock.WaitAsync(cancellationToken).ConfigureAwait(false))
            {
                _webSocketClient?.DisposeExceptionSafe(_logger);
                _webSocketClient = null;

                var webSocketClient = _componentContext.Resolve<IWebSocketClient>();
                var rtmStartResponse = await _slackService.CallApiAsync<RtmStartApiResponse>(
                    "rtm.start",
                    new Dictionary<string, string>
                    {
                        {"simple_latest", "true"},
                        {"no_unreads", "true"}
                    },
                    cancellationToken)
                    .ConfigureAwait(false);

                await webSocketClient.ConnectAsync(rtmStartResponse.Url, cancellationToken).ConfigureAwait(false);

                _self = rtmStartResponse.Self;
                _webSocketClient = webSocketClient;
                _webSocketClient.Messages.Subscribe(Received, Error); // No need to handle disposable
            }
        }