Interface NetworkManagerExtraParams

Additional params passed into NetworkManager by the user that customize the behavior of the manager

interface NetworkManagerExtraParams {
    connectionCount?: ConnectionCountDelegate;
    inactivityTimeout?: number;
    middlewares?: Middleware<RpcCallMiddlewareContext, unknown>[];
    usePfs?: boolean;
}

Properties

connectionCount?: ConnectionCountDelegate

Connection count for each connection kind. The function should be pure to avoid unexpected behavior.

Defaults to TDLib logic:

  • main: 0 (which stands for "handle internally, based on tmp_sessions value")
  • upload: if premium or dc id is other than 2 or 4, then 8, otherwise 4
  • download: if premium then 8, otherwise 2
  • downloadSmall: 2

Non-zero value for main is for advanced users only as it may lead to unexpected behavior, and is generally not recommended because of unnecessary extra load on both the server and the client as well as increased possibility of encountering AUTH_KEY_DUPLICATED errors.

inactivityTimeout?: number

Idle timeout for non-main connections, in ms

60000 (60 seconds).
middlewares?: Middleware<RpcCallMiddlewareContext, unknown>[]

List of middlewares to use for the network manager

Note: these middlewares apply to outgoing requests only. If you need to handle incoming updates, use a Dispatcher instead.

usePfs?: boolean

Whether to use PFS (Perfect Forward Secrecy) for all connections. This is disabled by default