Send() public method

public Send ( TeleSharp request ) : Task
request TeleSharp
return Task
Ejemplo n.º 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;
		}
Ejemplo n.º 2
0
        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;
        }