TGViewer
PWRTelegram API channel PWRTelegram API channel @pwrtelegram · 725 subscribers
Post #464 228

Forwarded from MadelineProto | Official Channel (Daniil Gentili)

And now, let's elaborate on async:
With MadelineProto 4.0, each update is handled in parallel using a separate thread, and everything is done in parallel (even on restricted webhosts, perfect for creating file downloader bots!).

When I say thread, I actually mean green thread (wikipedia), often called strand.

Strands are behave exactly like normal threads, except that they're implemented in user-space, and they're much faster, more reliable, and do not suffer from synchronization issues present with normal threads.

Each update you receive using the event handler or the callback handler is managed in parallel in separate green threads: the only thing you have to do to enable async with green threads is add a yield before calling MadelineProto methods.

Full async documentation with examples.

If your code still relies on the old synchronous behaviour, don't worry, there is backward compatibility.
However, old synchronous behaviour is deprecated, and I highly recommend you switch to async, due to the huge performance and parallelism benefits.
More from @pwrtelegram
  1. Oct 17, 2026Introducing MadelineProto 8.8.8, with video calls, group calls, livestreams and end-to-end…
  2. May 11, 2025And then, a long overdue post about my Autonomous System (AS198747), and an over more over…
  3. May 11, 2025The first series of posts I'll be adding here will be some technical deep dives into the p…
  4. May 11, 2025Happy to announce I've launched a blog, where I'll be posting news about all my different…
  5. Aug 25, 2024#FreeDurov.
  6. May 30, 2024MadelineProto was updated! MadelineProto 8.1.0 introduces an official Grafana dashboard fo…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →