An Open-Source Telegram Server in C#: Four Years Later

https://hackernoon.imgix.net/images/u4mUxyF3XZOMs8vkZMRncDyXujp2-3c83bew.png

When I decided to build an open-source Telegram server in C# four years ago, the first thing
I needed was a transport. I wrote about that part inBuilding a High Performance TCP Server in
C#
. The post ended with a TCP echo server built around SocketAsyncEventArgs, IValueTaskSource,
pooling, andSystem.IO.Pipelines.

That server is now called Ferrite. The TCP implementation survived with relatively few changes, but moving bytes was only the first step. To make an actual Telegram client connect, I had to implement MTProto, generate Telegram’s TL types, dispatch hundreds of methods, and reproduce enough server-side state for the client to behave normally.


Ferrite currently targets .NET 10 andTelegram API layer 214. It dispatches 494 of the 732 methods in
that layer. The more useful result is that patched versions of the official Android and iOS applications
can register, exchange messages, create groups and channels, transfer...

Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE

Read more