Documentation - v0.27.1
    Preparing search index...

    Interface MtClientOptions

    Options for MtClient

    interface MtClientOptions {
        apiHash: string;
        apiId: number;
        crypto: ICryptoProvider;
        defaultDcs?: DcOptions;
        disableUpdates?: boolean;
        enableErrorReporting?: boolean;
        initConnectionOptions?: Partial<
            Omit<RawInitConnectionRequest<TlObject>, "query" | "apiId">,
        >;
        logger?: Logger;
        logLevel?: number;
        network?: NetworkManagerExtraParams;
        overrideLayer?: number;
        platform: ICorePlatform;
        readerMap?: TlReaderMap;
        reconnectionStrategy?: ReconnectionStrategy;
        storage: IMtStorageProvider;
        storageOptions?: StorageManagerExtraOptions;
        testMode?: boolean;
        transport: TelegramTransport;
        useIpv6?: boolean;
        writerMap?: TlWriterMap;
    }
    Index

    Properties

    apiHash: string

    API hash from my.telegram.org

    apiId: number

    API ID from my.telegram.org

    Cryptography provider to allow delegating crypto to native addon, worker, etc.

    defaultDcs?: DcOptions

    Primary DC to use for initial connection. This does not mean this will be the only DC used, nor that this DC will actually be primary, this only determines the first DC the library will try to connect to. Can be used to connect to other networks (like test DCs).

    When session already contains primary DC, this parameter is ignored.

    Production DC 2.
    
    disableUpdates?: boolean

    If true, all API calls will be wrapped with tl.invokeWithoutUpdates, effectively disabling the server-sent events for the clients. May be useful in some cases.

    false
    
    enableErrorReporting?: boolean

    mtcute can send all unknown RPC errors to danog's error reporting service.

    This is fully anonymous (except maybe IP) and is only used to improve the library and developer experience for everyone working with MTProto. This is fully opt-in, and if you're too paranoid, you can disable it by manually passing enableErrorReporting: false to the client.

    false
    
    initConnectionOptions?: Partial<
        Omit<RawInitConnectionRequest<TlObject>, "query" | "apiId">,
    >

    Additional options for initConnection call. apiId and query are not available and will be ignored. Omitted values will be filled with defaults

    logger?: Logger

    Logger instance for the client. If not passed, a new one will be created.

    logLevel?: number

    Set logging level for the client. Shorthand for client.log.level = level.

    See static members of LogManager for possible values.

    Extra parameters for NetworkManager

    overrideLayer?: number

    EXPERT USE ONLY!

    Override TL layer used for the connection.

    Does not change the schema used.

    platform: ICorePlatform
    readerMap?: TlReaderMap

    EXPERT USE ONLY

    Override reader map used for the connection.

    reconnectionStrategy?: ReconnectionStrategy

    Reconnection strategy.

    simple reconnection strategy: first 0ms, then up to 5s (increasing by 1s)
    

    Storage to use for this client.

    Additional options for the storage manager

    testMode?: boolean

    Whether to connect to test servers.

    If passed, defaultDc defaults to Test DC 2.

    Must be passed if using test servers, even if you passed custom defaultDc

    Transport to use in the client.

    platform-specific transport: WebSocket on the web, TCP in node
    
    useIpv6?: boolean

    Whether to use IPv6 datacenters (IPv6 will be preferred when choosing a DC by id) (default: false)

    writerMap?: TlWriterMap

    EXPERT USE ONLY

    Override writer map used for the connection.