Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Session Abstract

Hierarchy

Index

Constructors

Methods

  • setDC(dcId: number, serverAddress: string, port: number): void
  • Sets the information of the data center address and port that the library should connect to, as well as the data center ID, which is currently unused.

    Parameters

    • dcId: number
    • serverAddress: string
    • port: number

    Returns void

  • load(): Promise<void>
  • setAuthKey(authKey?: AuthKey, dcId?: number): void
  • getAuthKey(dcId?: number): undefined | AuthKey
  • Turns the given key into an InputPeer (e.g. InputPeerUser). The library uses this method whenever an InputPeer is needed to suit several purposes (e.g. user only provided its ID or wishes to use a cached username to avoid extra RPC).

    Parameters

    Returns TypeInputPeer

  • close(): void
  • Called on client disconnection. Should be used to free any used resources. Can be left empty if none.

    Returns void

  • save(): void
  • called whenever important properties change. It should make persist the relevant session information to disk.

    Returns void

  • delete(): void
  • Called upon client.log_out(). Should delete the stored information from disk since it's not valid anymore.

    Returns void

  • processEntities(tlo: any): void
  • Processes the input TLObject or list and saves whatever information is relevant (e.g., ID or access hash).

    Parameters

    • tlo: any

    Returns void

Accessors

  • get dcId(): number
  • get serverAddress(): string
  • get port(): number
  • get authKey(): undefined | AuthKey
  • set authKey(value: undefined | AuthKey): void

Generated using TypeDoc