Send() public méthode

public Send ( TeleSharp request ) : Task
request TeleSharp
Résultat Task
Exemple #1
0
		public async Task<bool> Connect()
		{
			if (_session.AuthKey == null)
			{
				var result = await Authenticator.DoAuthentication(_transport);
				_session.AuthKey = result.AuthKey;
				_session.TimeOffset = result.TimeOffset;
			}
				

			_sender = new MtProtoSender(_transport, _session);

			var request = new InitConnectionRequest(_apiId);

			await _sender.Send(request);
			await _sender.Recieve(request);

			return true;
		}
        public async Task<bool> Connect(bool reconnect = false)
        {
            if (_session.AuthKey == null || reconnect)
            {
                var result = await Authenticator.DoAuthentication(_transport);
                _session.AuthKey = result.AuthKey;
                _session.TimeOffset = result.TimeOffset;
            }

            _sender = new MtProtoSender(_transport, _session);

            if (!reconnect)
            {
                var request = new InitConnectionRequest(_apiId);

                await _sender.Send(request);
                await _sender.Recieve(request);

                dcOptions = request.ConfigConstructor.dc_options;
            }

            return true;
        }