-
Notifications
You must be signed in to change notification settings - Fork 2
nim.session.NIMSession
nim/session.NIMSession
-
EventEmitter
<NIMSessionEvents
>↳
NIMSession
- eventNames
- listeners
- listenerCount
- emit
- on
- addListener
- once
- removeListener
- off
- removeAllListeners
- initEventHandlers
- queryStickTopSessionList
- setToStickTopSession
- updateToStickTopSession
- cancelToStickTopSession
- queryLastFewSessionAsync
- queryAllRecentSessionAsync
- deleteRecentSession
- deleteAllRecentSession
- deleteSessionRoamingMessage
- setUnreadCountZeroAsync
- setMultiUnreadCountZeroAsync
- setSessionTop
- setSessionExtendData
- setAllUnreadCountZeroAsync
- querySessionDataById
- queryHasmoreRoammsg
- queryAllHasmoreRoammsg
- updateHasmoreRoammsg
- deleteHasmoreRoammsg
▸ eventNames(): keyof NIMSessionEvents
[]
Return an array listing the events for which the emitter has registered listeners.
keyof NIMSessionEvents
[]
EventEmitter.eventNames
node_modules/eventemitter3/index.d.ts:15
▸ listeners<T
>(event
): (...args
: ArgumentMap
<NIMSessionEvents
>[Extract
<T
, keyof NIMSessionEvents
>]) => void
[]
Return the listeners registered for a given event.
Name | Type |
---|---|
T |
extends keyof NIMSessionEvents
|
Name | Type |
---|---|
event |
T |
(...args
: ArgumentMap
<NIMSessionEvents
>[Extract
<T
, keyof NIMSessionEvents
>]) => void
[]
EventEmitter.listeners
node_modules/eventemitter3/index.d.ts:20
▸ listenerCount(event
): number
Return the number of listeners listening to a given event.
Name | Type |
---|---|
event |
keyof NIMSessionEvents
|
number
EventEmitter.listenerCount
node_modules/eventemitter3/index.d.ts:27
▸ emit<T
>(event
, ...args
): boolean
Calls each of the listeners registered for a given event.
Name | Type |
---|---|
T |
extends keyof NIMSessionEvents
|
Name | Type |
---|---|
event |
T |
...args |
ArgumentMap <NIMSessionEvents >[Extract <T , keyof NIMSessionEvents >] |
boolean
EventEmitter.emit
node_modules/eventemitter3/index.d.ts:32
▸ on<T
>(event
, fn
, context?
): NIMSession
Add a listener for a given event.
Name | Type |
---|---|
T |
extends keyof NIMSessionEvents
|
Name | Type |
---|---|
event |
T |
fn |
(...args : ArgumentMap <NIMSessionEvents >[Extract <T , keyof NIMSessionEvents >]) => void
|
context? |
any |
EventEmitter.on
node_modules/eventemitter3/index.d.ts:40
▸ addListener<T
>(event
, fn
, context?
): NIMSession
Name | Type |
---|---|
T |
extends keyof NIMSessionEvents
|
Name | Type |
---|---|
event |
T |
fn |
(...args : ArgumentMap <NIMSessionEvents >[Extract <T , keyof NIMSessionEvents >]) => void
|
context? |
any |
EventEmitter.addListener
node_modules/eventemitter3/index.d.ts:45
▸ once<T
>(event
, fn
, context?
): NIMSession
Add a one-time listener for a given event.
Name | Type |
---|---|
T |
extends keyof NIMSessionEvents
|
Name | Type |
---|---|
event |
T |
fn |
(...args : ArgumentMap <NIMSessionEvents >[Extract <T , keyof NIMSessionEvents >]) => void
|
context? |
any |
EventEmitter.once
node_modules/eventemitter3/index.d.ts:54
▸ removeListener<T
>(event
, fn?
, context?
, once?
): NIMSession
Remove the listeners of a given event.
Name | Type |
---|---|
T |
extends keyof NIMSessionEvents
|
Name | Type |
---|---|
event |
T |
fn? |
(...args : ArgumentMap <NIMSessionEvents >[Extract <T , keyof NIMSessionEvents >]) => void
|
context? |
any |
once? |
boolean |
EventEmitter.removeListener
node_modules/eventemitter3/index.d.ts:63
▸ off<T
>(event
, fn?
, context?
, once?
): NIMSession
Name | Type |
---|---|
T |
extends keyof NIMSessionEvents
|
Name | Type |
---|---|
event |
T |
fn? |
(...args : ArgumentMap <NIMSessionEvents >[Extract <T , keyof NIMSessionEvents >]) => void
|
context? |
any |
once? |
boolean |
EventEmitter.off
node_modules/eventemitter3/index.d.ts:69
▸ removeAllListeners(event?
): NIMSession
Remove all listeners, or those of the specified event.
Name | Type |
---|---|
event? |
keyof NIMSessionEvents
|
EventEmitter.removeAllListeners
node_modules/eventemitter3/index.d.ts:79
▸ initEventHandlers(): void
注册全局回调
void
ts/nim/session.ts:46
▸ queryStickTopSessionList(cb
): Promise
<[NIMResCode
, string
]>
查询置顶会话列表
Note
200:成功
Name | Type | Description |
---|---|---|
cb |
null | QueryStickTopSessionListCallback
|
置顶会话列表查询结果的回调函数 |
Promise
<[NIMResCode
, string
]>
void 无返回值
ts/nim/session.ts:58
▸ setToStickTopSession(session_id
, to_type
, ext
, cb
): Promise
<[NIMResCode
, string
]>
设置置顶会话
Note
200:成功
Name | Type | Description |
---|---|---|
session_id |
string |
会话id |
to_type |
number |
会话类型 |
ext |
string |
扩展字段 |
cb |
null | SetToStickTopSessionCallback
|
置顶会话设置结果的回调函数 |
Promise
<[NIMResCode
, string
]>
void 无返回值
ts/nim/session.ts:80
▸ updateToStickTopSession(session_id
, to_type
, ext
, cb
): Promise
<[NIMResCode
, string
]>
更新置顶会话列表
Note
200:成功
Name | Type | Description |
---|---|---|
session_id |
string |
会话id |
to_type |
number |
会话类型 |
ext |
string |
扩展字段 |
cb |
null | UpdateStickTopSessionCallback
|
更新置顶会话设置结果的回调函数 |
Promise
<[NIMResCode
, string
]>
void 无返回值
ts/nim/session.ts:102
▸ cancelToStickTopSession(session_id
, to_type
, cb
): Promise
<[NIMResCode
, string
, NIMSessionType
]>
取消置顶会话列表
Note
200:成功
Name | Type | Description |
---|---|---|
session_id |
string |
会话id |
to_type |
number |
会话类型 |
cb |
null | CancelToStickTopSessionCallback
|
取消置顶会话设置结果的回调函数 |
Promise
<[NIMResCode
, string
, NIMSessionType
]>
void 无返回值
ts/nim/session.ts:123
▸ queryLastFewSessionAsync(limit
, cb
, jsonExtension
): Promise
<[NIMResCode
, SessionDataList
]>
查询指定数量的最后会话数据
Name | Type | Description |
---|---|---|
limit |
number |
要返回的最大数量 |
cb |
null | QuerySessionListCallback
|
查询会话列表的回调函数 |
jsonExtension |
string |
json扩展参数(备用,目前不需要) |
Promise
<[NIMResCode
, SessionDataList
]>
void 无返回值
ts/nim/session.ts:140
▸ queryAllRecentSessionAsync(msg_excluded_type_list
, cb
, jsonExtension
): Promise
<[NIMResCode
, SessionDataList
]>
查询会话列表,可指定最后一条会话消息要排除掉的类型(列表)
Name | Type | Description |
---|---|---|
msg_excluded_type_list |
NIMMessageType [] |
最后一条会话消息要排除掉的类型(列表),如果不排除任何消息,传入空列表 |
cb |
null | QuerySessionListCallback
|
查询会话列表的回调函数 |
jsonExtension |
string |
json扩展参数(备用,目前不需要) |
Promise
<[NIMResCode
, SessionDataList
]>
void 无返回值
ts/nim/session.ts:161
▸ deleteRecentSession(type
, id
, cb
, delete_roaming
): Promise
<[NIMResCode
, SessionData
, number
]>
删除最近联系人
Note
200:成功
Name | Type | Description |
---|---|---|
type |
NIMSessionType |
- |
id |
string |
对方的account id或者群组tid。 |
cb |
null | SessionChangeCallback
|
最近会话列表项变更的回调函数 |
delete_roaming |
boolean |
是否同时删除漫游消息 |
Promise
<[NIMResCode
, SessionData
, number
]>
boolean 检查参数如果不符合要求则返回失败
ts/nim/session.ts:191
▸ deleteAllRecentSession(cb
, jsonExtension
): Promise
<[NIMResCode
, SessionData
, number
]>
删除全部最近联系人
Note
200:成功
Name | Type | Description |
---|---|---|
cb |
null | SessionChangeCallback
|
最近会话列表项变更的回调函数 |
jsonExtension |
string |
json扩展参数(备用,目前不需要) |
Promise
<[NIMResCode
, SessionData
, number
]>
void 无返回值
ts/nim/session.ts:221
▸ deleteSessionRoamingMessage(to_type
, session_id
, cb
, ext
): Promise
<[NIMResCode
, number
, string
]>
删除某会话的漫游消息
Note
200:成功
Name | Type | Description |
---|---|---|
to_type |
number |
会话类型,双人0,群组1 (nim_msglog_def.h) |
session_id |
string |
- |
cb |
null | DeleteSessionRoamingMessageCallback
|
删除结果 回调回调函数 |
ext |
string |
- |
Promise
<[NIMResCode
, number
, string
]>
boolean 检查参数如果不符合要求则返回失败
ts/nim/session.ts:243
▸ setUnreadCountZeroAsync(type
, id
, cb
, jsonExtension
): Promise
<null
| [NIMResCode
, SessionData
, number
]>
最近联系人项未读数清零
Note
200:成功
Name | Type | Description |
---|---|---|
type |
NIMSessionType |
- |
id |
string |
对方的account id或者群组tid。 |
cb |
null | SessionChangeCallback
|
最近会话列表项变更的回调函数 |
jsonExtension |
string |
json扩展参数(备用,目前不需要) |
Promise
<null
| [NIMResCode
, SessionData
, number
]>
boolean 检查参数如果不符合要求则返回失败
ts/nim/session.ts:275
▸ setMultiUnreadCountZeroAsync(is_super_team
, zero_list
, cb
): Promise
<null
| [NIMResCode
, SessionData
[], number
]>
最近联系人项未读数清零
Note
200:成功
Name | Type | Description |
---|---|---|
is_super_team |
boolean |
会话列表中的会话是否是超大群会话 |
zero_list |
MultiUnreadCountZeroInfo [] |
清零的会话信息列表。 |
cb |
null | SetMultiUnreadCountZeroAsyncCallback
|
最近会话列表项变更的回调函数 |
Promise
<null
| [NIMResCode
, SessionData
[], number
]>
boolean 检查参数如果不符合要求则返回失败
ts/nim/session.ts:310
▸ setSessionTop(type
, id
, top
, cb
, jsonExtension
): Promise
<null
| [NIMResCode
, SessionData
, number
]>
设置会话项是否置顶(置顶属性只保存在本地)
Note
200:成功
Name | Type | Description |
---|---|---|
type |
NIMSessionType |
- |
id |
string |
对方的account id或者群组tid。 |
top |
boolean |
true - 置顶 false - 取消置顶 |
cb |
null | SessionChangeCallback
|
回调函数 |
jsonExtension |
string |
json扩展参数(备用,目前不需要) |
Promise
<null
| [NIMResCode
, SessionData
, number
]>
boolean 检查参数如果不符合要求则返回失败
ts/nim/session.ts:341
▸ setSessionExtendData(type
, id
, data
, cb
, jsonExtension
): Promise
<null
| [NIMResCode
, SessionData
, number
]>
设置会话项扩展数据(扩展数据只保存在本地)
Note
200:成功
Name | Type | Description |
---|---|---|
type |
NIMSessionType |
- |
id |
string |
对方的account id或者群组tid。 |
data |
string |
扩展数据,建议使用灵活可扩展的数据结构,例如Json |
cb |
null | SessionChangeCallback
|
回调函数 |
jsonExtension |
string |
json扩展参数(备用,目前不需要) |
Promise
<null
| [NIMResCode
, SessionData
, number
]>
boolean 检查参数如果不符合要求则返回失败
ts/nim/session.ts:380
▸ setAllUnreadCountZeroAsync(cb
, jsonExtension
): Promise
<null
| [NIMResCode
, SessionData
, number
]>
最近联系人项全部未读数清零
Note
200:成功
Name | Type | Description |
---|---|---|
cb |
null | SessionChangeCallback
|
最近会话列表项变更的回调函数 |
jsonExtension |
string |
json扩展参数(备用,目前不需要) |
Promise
<null
| [NIMResCode
, SessionData
, number
]>
boolean 检查参数如果不符合要求则返回失败
ts/nim/session.ts:416
▸ querySessionDataById(type
, id
, cb
, jsonExtension
): Promise
<[NIMResCode
, SessionData
]>
根据给定的id查询相应会话的信息
Note
200:成功
Name | Type | Description |
---|---|---|
type |
NIMSessionType |
- |
id |
string |
对方的account id或者群组tid。 |
cb |
null | QuerySessionDataCallback
|
会话信息查询结果的回调函数 |
jsonExtension |
string |
json扩展参数(备用,目前不需要) |
Promise
<[NIMResCode
, SessionData
]>
void 无返回值
ts/nim/session.ts:442
▸ queryHasmoreRoammsg(session_id
, to_type
, cb
): Promise
<[NIMResCode
, SessionRoamMsgHasMoreTagInfo
]>
查询会话是漫游消息未拉取信息
Note
200:成功
Name | Type | Description |
---|---|---|
session_id |
string |
会话id |
to_type |
number |
会话类型 |
cb |
null | QueryHasmoreRoammsgCallback
|
查询会话是漫游消息未拉取信息回调函数 |
Promise
<[NIMResCode
, SessionRoamMsgHasMoreTagInfo
]>
void 无返回值
ts/nim/session.ts:468
▸ queryAllHasmoreRoammsg(cb
): Promise
<[NIMResCode
, SessionRoamMsgHasMoreTagInfo
[]]>
查询所有漫游消息未拉取完全的会话
Name | Type | Description |
---|---|---|
cb |
null | QueryAllHasmoreRoammsgCallback
|
结果回调 |
Promise
<[NIMResCode
, SessionRoamMsgHasMoreTagInfo
[]]>
void 无返回值
ts/nim/session.ts:483
▸ updateHasmoreRoammsg(msg
, cb
): Promise
<[NIMResCode
]>
更新会话是漫游消息未拉取信息
Name | Type | Description |
---|---|---|
msg |
IMMessage |
对应的消息内容 |
cb |
null | UpdateHasmoreRoammsgCallback
|
结果回调 |
Promise
<[NIMResCode
]>
void 无返回值
ts/nim/session.ts:499
▸ deleteHasmoreRoammsg(session_id
, to_type
, cb
): Promise
<[NIMResCode
]>
删除会话是漫游消息未拉取信息
Name | Type | Description |
---|---|---|
session_id |
string |
会话id |
to_type |
NIMSessionType |
会话类型 |
cb |
null | DeleteHasmoreRoammsgCallback
|
结果回调 |
Promise
<[NIMResCode
]>
void 无返回值
ts/nim/session.ts:516
• session: NIMSessionAPI
ts/nim/session.ts:39
• new NIMSession()
EventEmitter<NIMSessionEvents>.constructor
ts/nim/session.ts:40
- chatroom/chatroom
- chatroom_def/chatroom_def
- nim/client
- nim/data_sync
- nim/friend
- nim/global
- nim/msglog
- nim/nos
- nim/online_session
- nim/pass_through_proxy
- nim/plugin
- nim/session
- nim/subscribe_event
- nim/super_team
- nim/sysmsg
- nim/talk
- nim/talkex
- nim/team
- nim/tool
- nim/user
- nim_def/client_def
- nim_def/data_sync_def
- nim_def/doc_trans_def
- nim_def/friend_def
- nim_def/global_def
- nim_def/msglog_def
- nim_def/nos_def
- nim_def/online_session_def
- nim_def/pass_through_proxy_def
- nim_def/plugin_def
- nim_def/session_def
- nim_def/subscribe_event_def
- nim_def/super_team_def
- nim_def/sysmsg_def
- nim_def/talk_def
- nim_def/talkex_def
- nim_def/team_def
- nim_def/tool_def
- nim_def/user_def
- node-nim
- qchat/attachment
- qchat/channel
- qchat/channel_category
- qchat/instance
- qchat/message
- qchat/role
- qchat/server
- qchat/system_notification
- qchat_def/attachment_def
- qchat_def/channel_def
- qchat_def/instance_def
- qchat_def/message_def
- qchat_def/public_def
- qchat_def/role_def
- qchat_def/server_def
- qchat_def/system_notification_def