Options
All
  • Public
  • Public/Protected
  • All
Menu

Module NIMInterface

Index

Type aliases

KickOptions: { deviceIds: string[] }

Type declaration

  • deviceIds: string[]

    要踢掉的端的设备号数组

    端设备号能在 multiPortLogin 多端登陆事件里拿到

KickResult: { deviceIds: string[] }

Type declaration

  • deviceIds: string[]

    成功被踢掉的设备号数组

LoginResult: { aosPushInfo?: { hasTokenPreviously?: boolean; pushType?: number }; connectionId: string; country?: string; customTag?: string; ip: string; lastLoginDeviceId?: string; port: string }

Type declaration

  • Optional aosPushInfo?: { hasTokenPreviously?: boolean; pushType?: number }

    AOS 推荐推送配置信息

    • Optional hasTokenPreviously?: boolean
    • Optional pushType?: number
  • connectionId: string

    连接id

  • Optional country?: string
  • Optional customTag?: string

    自定义登陆标签

  • ip: string
  • Optional lastLoginDeviceId?: string

    上一次登陆的设备 id

  • port: string

    端口

NIMInitializeOptions: { account: string; appkey: string; debugLevel?: string; lbsUrls?: string[]; linkUrl?: string; needReconnect?: boolean; reconnectionAttempts?: number; token: string }

NIM 的构造函数初始化参数

eg. new NIM({ ...NIMInitializeOptions })

Type declaration

  • account: string
  • appkey: string
  • Optional debugLevel?: string

    日志分级

    可选值,"off" | "error" | "warn" | "log" | "debug"

  • Optional lbsUrls?: string[]

    lbs 地址,默认为云信公网提供的链接。SDK 连接时会向 lbs 地址请求得到 socket 连接地址。

    注:为了防止 lbs 链接被网络运营商劫持,开发者可以传入自己代理的地址做备份,['公网地址', '代理地址']

  • Optional linkUrl?: string

    socket 备用地址,当 lbs 请求失败时,尝试直接连接 socket 备用地址。

    注:优先级最高的是 lbs 地址下发的 socket 连接地址, 次为开发者在此填的 socket 备用地址(如果不填这个字段, SDK 会有内部默认的备用地址)

  • Optional needReconnect?: boolean

    是否需要自动重连

  • Optional reconnectionAttempts?: number

    自动重连尝试次数

  • token: string
SyncOfflineMsgsResult: { msgs: IMMessage[]; sessionId: string; timetag: number }

Type declaration

  • msgs: IMMessage[]
  • sessionId: string
  • timetag: number
SyncOptions: { deleteSelfMsgs?: boolean; deleteSuperTeamMsg?: boolean; friendUsers?: boolean; friends?: boolean; msgReceipts?: boolean; myInfo?: boolean; myTeamMembers?: boolean; offlineMsgs?: boolean; recallMsg?: boolean; relations?: boolean; roamingMsgs?: boolean; sessionAck?: boolean; sessionHistoryMsgsDelete?: boolean; stickTopSessions?: boolean; superTeamRoamingMsgs?: boolean; superTeamSessionAck?: boolean; superTeams?: boolean; teams?: boolean }

Type declaration

  • Optional deleteSelfMsgs?: boolean

    是否同步单向删除信息,默认 true

  • Optional deleteSuperTeamMsg?: boolean

    是否同步超大群撤回消息离线和漫游通知,默认 true

  • Optional friendUsers?: boolean

    是否同步好友的用户名片。默认 true

  • Optional friends?: boolean

    是否同步好友列表。默认 true

  • Optional msgReceipts?: boolean

    是否同步已读回执。默认 true

  • Optional myInfo?: boolean

    是否同步用户信息。默认 true

  • Optional myTeamMembers?: boolean

    是否同步当前用户的所有群的群成员信息。默认 false

  • Optional offlineMsgs?: boolean

    是否同步离线消息和离线系统通知。默认 true

  • Optional recallMsg?: boolean

    是否同步撤回消息离线和漫游通知。默认 true

  • Optional relations?: boolean

    是否同步黑名单和静音列表。默认 true

  • Optional roamingMsgs?: boolean

    是否同步漫游消息。默认 true

  • Optional sessionAck?: boolean

    是否同步消息会话 ack,时间戳单位毫秒。默认 false

    会话 ACK 代表本账号在此会话里读过的最新消息的时间戳

  • Optional sessionHistoryMsgsDelete?: boolean

    是否同步会话历史消息的删除信息。默认 true

  • Optional stickTopSessions?: boolean

    是否同步置顶会话信息,默认 false

  • Optional superTeamRoamingMsgs?: boolean

    是否同步超大群漫游消息。默认 true

  • Optional superTeamSessionAck?: boolean

    是否同步超大群会话 ack 位置列表,默认 false

  • Optional superTeams?: boolean

    是否同步超大群信息,默认 true

  • Optional teams?: boolean

    是否同步群列表。默认 true

SyncRoamingMsgsResult: { msgs: IMMessage[]; sessionId: string; timetag: number }

Type declaration

  • msgs: IMMessage[]
  • sessionId: string
  • timetag: number
TKickedReason: { message: string; reason: "unknow" | "samePlatformKick" | "serverKick" | "otherPlatformKick" | "silentlyKick" }

Type declaration

  • message: string
  • reason: "unknow" | "samePlatformKick" | "serverKick" | "otherPlatformKick" | "silentlyKick"

    未知 | 互斥类型的客户端互踢-不允许同一个帐号在多个地方同时登录 | 服务器端发起踢客户端指令-被服务器踢了 | 被自己账号所在的其他端踢掉 | 被悄悄踢掉, 表示这个链接已经废掉了

TProxyMsg: { body: string; from: string; time: number }

Type declaration

  • body: string
  • from: string
  • time: number
TTransferTeamResult: { from: { id: string; type: string; updateTime: number }; team: Team; to: { id: string; type: string; updateTime: number } }

Type declaration

  • from: { id: string; type: string; updateTime: number }
    • id: string
    • type: string
    • updateTime: number
  • team: Team
  • to: { id: string; type: string; updateTime: number }
    • id: string
    • type: string
    • updateTime: number
TUpdateSuperTeamManagersResult: { accounts: string; isManager: boolean; members: SuperTeamMember; team: { memberUpdateTime: number; teamId: string } }

Type declaration

  • accounts: string
  • isManager: boolean
  • members: SuperTeamMember
  • team: { memberUpdateTime: number; teamId: string }
    • memberUpdateTime: number
    • teamId: string
TUpdateTeamManagersResult: { accounts: string; isManager: boolean; members: TeamMember; team: { memberUpdateTime: number; teamId: string } }

Type declaration

  • accounts: string
  • isManager: boolean
  • members: TeamMember
  • team: { memberUpdateTime: number; teamId: string }
    • memberUpdateTime: number
    • teamId: string
TUpdateTeamMembersMute: { accounts: string[]; members: TeamMember[]; mute: boolean; team: Team }

Type declaration

TWillReconnect: { duration: number; retryCount: number }

Type declaration

  • duration: number

    重试间隔

  • retryCount: number

    重试次数

multiPortLoginResult: { account: string; connectionId: string; deviceId: string; ip: string; mac: string; online: boolean; os: string; time: number; type: TClientType }

Type declaration

  • account: string
  • connectionId: string

    socket 连接 id

  • deviceId: string

    设备id

  • ip: string
  • mac: string
  • online: boolean

    是否在线

  • os: string

    系统版本

  • time: number
  • type: TClientType