Hierarchy (view full)

Constructors

  • Parameters

    • p: Platform = Platform.Android
    • d: {
          --begin--: string;
          --end--: string;
          android_id: string;
          board: string;
          boot_id: string;
          bootloader: string;
          brand: string;
          device: string;
          display: string;
          incremental: string;
          ip_address: string;
          mac_address: string;
          model: string;
          proc_version: string;
          product: string;
          wifi_ssid: string;
      }
      • --begin--: string
      • --end--: string
      • android_id: string
      • board: string
      • boot_id: string
      • bootloader: string
      • brand: string
      • device: string
      • display: string
      • incremental: string
      • ip_address: string
      • mac_address: string
      • model: string
      • proc_version: string
      • product: string
      • wifi_ssid: string
    • config: Required<Config>

    Returns BaseClient

Properties

apk: Apk
config: Required<Config>
device: Device
emp_interval: number = ...

token刷新间隔(秒)

heartbeat: (() => void) = NOOP

随心跳一起触发的函数,可以随意设定

Type declaration

    • (): void
    • no operation

      Returns void

interval: number = 60

心跳间隔(秒)

login_timer: null | Timeout = null
pkg: any = ...
pskey: {
    [domain: string]: Buffer;
} = {}
pt4token: {
    [domain: string]: Buffer;
} = {}
register_retry_num: number = 3

上线失败重试次数

sig: Record<string, any> = ...
sign_type: string = ""
signCmd: String[] = []
statistics: {
    lost_pkt_cnt: number;
    lost_times: number;
    msg_cnt_per_min: number;
    recv_msg_cnt: number;
    recv_pkt_cnt: number;
    remote_ip: string;
    remote_port: number;
    sent_msg_cnt: number;
    sent_pkt_cnt: number;
    start_time: number;
    ver: string;
} = ...

数据统计

token_retry_num: number = 2

token登录重试次数

uid: string
uin: number

Methods

  • Type Parameters

    • T extends Trapper = this

    Parameters

    • this: T
    • matcher: Matcher
    • listener: Listener

    Returns ToDispose<T>

  • Parameters

    • pathname: string

    Returns Promise<{
        code: number;
    }>

  • Parameters

    • matcher: Matcher
    • Rest...args: any[]

    Returns any

  • Parameters

    • matcher: Matcher
    • Rest...args: any[]

    Returns Promise<any>

  • Parameters

    • sign: String
    • token: String
    • extra: String

    Returns Buffer

  • Parameters

    • cmd: string
    • seq: number
    • body: Buffer

    Returns Promise<Buffer>

  • Parameters

    • Optionalmatcher: Matcher

    Returns Listener[]

  • 下线 (keepalive: 是否保持tcp连接)

    Parameters

    • keepalive: boolean = false

    Returns Promise<void>

  • Parameters

    • matcher: Matcher
    • Optionallistener: Listener

    Returns void

  • 收到二维码

    Parameters

    • name: "internal.qrcode"
    • listener: ((this: this, qrcode: Buffer) => void)
        • (this, qrcode): void
        • Parameters

          • this: this
          • qrcode: Buffer

          Returns void

    Returns ToDispose<BaseClient>

  • 收到滑动验证码

    Parameters

    • name: "internal.slider"
    • listener: ((this: this, url: string) => void)
        • (this, url): void
        • Parameters

          • this: this
          • url: string

          Returns void

    Returns ToDispose<BaseClient>

  • 登录保护验证

    Parameters

    • name: "internal.verify"
    • listener: ((this: this, url: string, phone: string) => void)
        • (this, url, phone): void
        • Parameters

          • this: this
          • url: string
          • phone: string

          Returns void

    Returns ToDispose<BaseClient>

  • token过期(此时已掉线)

    Parameters

    • name: "internal.error.token"
    • listener: ((this: this) => void)
        • (this): void
        • Parameters

          • this: this

          Returns void

    Returns ToDispose<BaseClient>

  • 网络错误

    Parameters

    • name: "internal.error.network"
    • listener: ((this: this, code: number, message: string) => void)
        • (this, code, message): void
        • Parameters

          • this: this
          • code: number
          • message: string

          Returns void

    Returns ToDispose<BaseClient>

  • 密码登录相关错误

    Parameters

    • name: "internal.error.login"
    • listener: ((this: this, code: number, message: string) => void)
        • (this, code, message): void
        • Parameters

          • this: this
          • code: number
          • message: string

          Returns void

    Returns ToDispose<BaseClient>

  • 扫码登录相关错误

    Parameters

    • name: "internal.error.qrcode"
    • listener: ((this: this, code: QrcodeResult, message: string) => void)
        • (this, code, message): void
        • Parameters

          Returns void

    Returns ToDispose<BaseClient>

  • 登录成功

    Parameters

    • name: "internal.online"
    • listener: ((this: this, token: Buffer, nickname: string, gender: number, age: number) => void)
        • (this, token, nickname, gender, age): void
        • Parameters

          • this: this
          • token: Buffer
          • nickname: string
          • gender: number
          • age: number

          Returns void

    Returns ToDispose<BaseClient>

  • token更新

    Parameters

    • name: "internal.token"
    • listener: ((this: this, token: Buffer) => void)
        • (this, token): void
        • Parameters

          • this: this
          • token: Buffer

          Returns void

    Returns ToDispose<BaseClient>

  • 服务器强制下线

    Parameters

    • name: "internal.kickoff"
    • listener: ((this: this, reason: string) => void)
        • (this, reason): void
        • Parameters

          • this: this
          • reason: string

          Returns void

    Returns ToDispose<BaseClient>

  • 业务包

    Parameters

    • name: "internal.sso"
    • listener: ((this: this, cmd: string, payload: Buffer, seq: number) => void)
        • (this, cmd, payload, seq): void
        • Parameters

          • this: this
          • cmd: string
          • payload: Buffer
          • seq: number

          Returns void

    Returns ToDispose<BaseClient>

  • 日志信息

    Parameters

    • name: "internal.verbose"
    • listener: ((this: this, verbose: unknown, level: VerboseLevel) => void)
        • (this, verbose, level): void
        • Parameters

          Returns void

    Returns ToDispose<BaseClient>

  • Parameters

    • name: string | symbol
    • listener: ((this: this, ...args: any[]) => void)
        • (this, ...args): void
        • Parameters

          • this: this
          • Rest...args: any[]

          Returns void

    Returns ToDispose<BaseClient>

  • Parameters

    • matcher: Matcher
    • listener: Listener

    Returns ToDispose<BaseClient>

  • 使用密码登录

    Parameters

    • uin: number

      登录账号

    • md5pass: Buffer

      密码的md5值

    Returns Promise<void>

  • 获取扫码结果(可定时查询,retcode为0则调用qrcodeLogin登录)

    Returns Promise<{
        retcode: number;
        t106: undefined | Buffer;
        t16a: undefined | Buffer;
        t318: undefined | Buffer;
        tgtgt: undefined | Buffer;
        uin: undefined | number;
    }>

  • Parameters

    • force: boolean = false

    Returns Promise<undefined | boolean>

  • Parameters

    • logout: boolean = false
    • reflush: boolean = false

    Returns Promise<unknown>

  • dont use it if not clear the usage

    Parameters

    • cmd: string
    • body: Uint8Array
    • timeout: number = 5

    Returns Promise<Buffer>

  • Parameters

    • cmd: string
    • body: object | Uint8Array

    Returns Promise<any>

  • Parameters

    • type: string
    • cmd: string
    • body: any

    Returns Promise<Buffer>

  • 收到设备锁验证请求后,用于发短信

    Returns Promise<void>

  • 发送一个业务包并等待返回

    Parameters

    • cmd: string
    • body: Uint8Array
    • timeout: number = 5

    Returns Promise<Buffer>

  • 设置连接服务器,不设置则自动搜索

    Parameters

    • Optionalhost: string
    • Optionalport: number

    Returns void

  • 收到滑动验证码后,用于提交滑动验证码

    Parameters

    • ticket: string

    Returns Promise<void>

  • 提交短信验证码

    Parameters

    • code: string

    Returns Promise<void>

  • Parameters

    • cmd: string
    • callbackId: number
    • body: Buffer

    Returns Promise<Packet[]>

  • 使用接收到的token登录

    Parameters

    • token: Buffer = BUF0
    • cmd: number = 15

    Returns Promise<Buffer>

  • Parameters

    • matcher: Matcher
    • listener: Listener

    Returns ToDispose<BaseClient>

  • Parameters

    • matcher: Matcher
    • listener: Listener

    Returns Dispose

  • Parameters

    • matcher: Matcher
    • Rest...args: any[]

    Returns void

  • Parameters

    • matcher: Matcher
    • Rest...args: any[]

    Returns Promise<void>

  • 发送一个业务包不等待返回

    Parameters

    • cmd: string
    • body: Uint8Array
    • seq: number = 0

    Returns Promise<void>