Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of <see cref="Connection"/>.
        /// </summary>
        /// <param name="channel">The <see cref="Channel"/> to be used for communication.</param>
        public Connection(Channel channel)
        {
            ExceptionHelper.ThrowIfNull(nameof(channel), channel);

            var client = new ChatService.ChatServiceClient(channel);

            _channel      = channel;
            _duplexStream = client.Subscribe();
            _subscription = ReadMessagesAsync(_tokenSource.Token);
        }