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; }