Properties
Private Readonly _context
_context: default
Private _token
_token: string = ''
Conversation
ChatRoom
Tag
Readonly logger
logger: ILogger
Constructors
constructor
- new IMClient(apiContext: default, logger: ILogger): IMClient
Parameters
apiContext: default
logger: ILogger
Methods
install
- install<T, O>(plugin: IPluginGenerator<T, O>, options: O): null | T
Type Parameters
Parameters
plugin: IPluginGenerator<T, O>
options: O
Returns null | T
Private _listenerFn
- _listenerFn(event: ((params: any) => void), params?: any): void
Parameters
event: ((params: any) => void)
Optional params: any
Returns void
watch
Parameters
Returns void
unwatch
Returns void
connect
- connect(options: { token: string }): Promise<{ id: string }>
Parameters
options: { token: string }
Returns Promise<{ id: string }>
reconnect
- reconnect(): Promise<{ id: string }>
Returns Promise<{ id: string }>
disconnect
- disconnect(): Promise<void>
Returns Promise<void>
getAppInfo
getConnectedTime
- getConnectedTime(): number
Returns number
getServerTime
Returns number
getConnectionStatus
getConnectionUserId
- getConnectionUserId(): string
Returns string
getFileToken
- getFileToken(fileType: FileType, fileName?: string, httpMethod?: "PUT" | "POST", queryString?: string): Promise<IUploadAuth & { bos: string; qiniu: string }>
Parameters
Optional fileName: string
Optional httpMethod: "PUT" | "POST"
Optional queryString: string
Returns Promise<IUploadAuth & { bos: string; qiniu: string }>
getFileUrl
- getFileUrl(fileType: FileType, filename?: string, saveName?: string, uploadRes?: { isBosRes: boolean; downloadUrl: string }, serverType?: UploadMethod): Promise<{ downloadUrl: string }>
Parameters
Optional filename: string
Optional saveName: string
Optional uploadRes: { isBosRes: boolean; downloadUrl: string }
isBosRes: boolean
downloadUrl: string
Returns Promise<{ downloadUrl: string }>
changeUser
- changeUser(options: { token: string }): Promise<{ id: string }>
Parameters
options: { token: string }
Returns Promise<{ id: string }>
registerMessageType
- registerMessageType(messageType: string, isPersited: boolean, isCounted: boolean, prototypes?: string[]): void
Parameters
messageType: string
isPersited: boolean
isCounted: boolean
Optional prototypes: string[]
Returns void
装载 plugin 插件,并返回相应的插件实例,需在调用
connect
方法之前使用