How to subscribe to updates in Telegram Api?

Viewed 342

My question is a copy of this question

However, I don't understand how to use the answer given there

The library I am using already implements what the answer says

TelegramClient.cs    
var config = new TLRequestGetConfig();
var request = new TLRequestInitConnection()
{
    ApiId = apiId,
    AppVersion = "1.0.0",
    DeviceModel = "PC",
    LangCode = "en",
    Query = config,
    SystemVersion = "Win 10.0",
    SystemLangCode = "en",
    LangPack = ""
};
var invokewithLayer = new TLRequestInvokeWithLayer() { Layer = 108, Query = request };
await sender.Send(invokewithLayer, token).ConfigureAwait(false);
await sender.Receive(invokewithLayer, token).ConfigureAwait(false);

dcOptions = ((TLConfig)invokewithLayer.Response).DcOptions.ToList();

Where does Telegram send updates?

I thought the updates could be read in the TcpClient that the TelegramClient has, but no, it doesn't receive updates

The documentation says:

Update events are sent to an authorized user into the last active connection (except for connections needed for downloading / uploading files).

So to start receiving updates the client needs to init connection and call API method, e.g. to fetch current state.

But where does it send updates? How do I subscribe to them / how do I read them?

P.S. updates.getDifference is not what i'm looking for

UPD

I've already looked at all the source code, but the most I found is processMessage in MtProtoSender, but it only handles manually sent requests

Another library based on TDLib handles incoming updates. Trying to understand how it does it, I got to this point. What is going on here and how can I do the same in TLSharp I do not understand

Same problem in another library which was solved but doesn't work for me

0 Answers
Related