Crate grammers_mtsender

Crate grammers_mtsender 

Source
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§

ConnectionParams
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.
SenderPool
Named type holding the actual runner and initial handles. The entry point.
SenderPoolHandle
Cheaply cloneable handle to interact with its SenderPoolRunner.
SenderPoolRunner
Manages and runs a pool of zero or more Senders.

Enums§

InvocationError
This error occurs when a Remote Procedure call was unsuccessful.
ReadError
This error occurs when reading from the network fails.
ServerAddr
Represents a socket address which may be proxied.

Functions§

connect
Helper function to Sender::connect a plain transport and generate_auth_key on it.
connect_with_auth
Helper function to Sender::connect an 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.