Expand description
This library serves to abstract the connection to Telegram’s servers.
The Sender is the base building block that manages a single network
connection, the transport state, and the MTP state, as well as taking
care of buffering messages before sending them off in a single container.
To interact with the API, it is often needed to create more than one
connection, for either migrations during sign in or media downloads.
To that end, the SenderPool is the one that manages any number
of Sender. This will commonly be the entry point to using this library.
Generally, there will be a single SenderPool instance per client,
although many tasks can share access to the same SenderPool via
multiple SenderPoolHandles.
Structs§
- Connection
Params - Connection parameters used whenever a new connection is initialized.
- RpcError
- The error type reported by the server when a request is misused.
- Sender
- Manages enqueuing requests, matching them to their response, and IO.
- Sender
Pool - Named type holding the actual runner and initial handles. The entry point.
- Sender
Pool Handle - Cheaply cloneable handle to interact with its
SenderPoolRunner. - Sender
Pool Runner - Manages and runs a pool of zero or more
Senders.
Enums§
- Invocation
Error - This error occurs when a Remote Procedure call was unsuccessful.
- Read
Error - This error occurs when reading from the network fails.
- Server
Addr - Represents a socket address which may be proxied.
Functions§
- connect
- Helper function to
Sender::connecta plain transport andgenerate_auth_keyon it. - connect_
with_ auth - Helper function to
Sender::connectan encrypted transport with a previous Authorization Key. - generate_
auth_ key - Uses the input plain sender to carry the Authorization Key generation process, and returns an encrypted sender reusing the same connection, transport and buffers.