
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
@efox/chatroom
Advanced tools
import createChatroom from '@efox/chatroom'
const chatromm = await createChatroom(options)
请求参数:Object
| Name | Type | Description |
|---|---|---|
| hummer? | Hummer | 原始hummer(没传会自动创建) |
| otp | string | 用户token(没传原始hummer时,必须传) |
| appid? | string | 应用appid(没传原始hummer时,必须传) |
| region? | string | 用户区域(没传原始hummer时,必须传) |
| roomid? | string | 房间id(没传会自动创建) |
| extListenEvents? | array | 补充监听事件列表 |
响应数据:Object
| Name | Type | Description |
|---|---|---|
| chatromm | Object | 房间实例 |
const {roomid, root, hummer} = chatromm
| Name | Type | Description |
|---|---|---|
| roomid | string | 房间id |
| hummer | object | 原始hummer |
| root | object | 原始hummer创建的原始chatroom实例 |
chatromm.send({
event: '',
data: {
content: ''
}
})
请求参数:Object
| Name | Type | Description |
|---|---|---|
| event | string | 发送事件类型 |
| data | Object | 发送数据 |
响应数据:Object
| Name | Type | Description |
|---|---|---|
| rescode | number | 0:表示成功 |
| msg | string | 返回描述 |
请求参数:
| Name | Type | Description |
|---|---|---|
| content | string | 内容 |
| kvExtra | {[k: string]: string} | 扩展字段key-value |
响应数据:
| Name | Type | Description |
|---|---|---|
| rescode | number | 0:表示成功 |
| msg | string | 返回描述 |
示例:
const await res = chatromm.send({
event: 'sendGroupMessage',
data: {
content,
kvExtra
}
})
请求参数:
| Name | Type | Description |
|---|---|---|
| content | string | 内容 |
| receiver | string | 接收者uid |
| kvExtra | {[k: string]: string} | 扩展字段key-value |
响应数据:
| Name | Type | Description |
|---|---|---|
| rescode | number | 0:表示成功 |
| msg | string | 返回描述 |
示例:
const await res = chatromm.send({
event: 'sendSingleUserMessage',
data: {
content, receiver, kvExtra
}
})
请求参数:
| Name | Type | Description |
|---|---|---|
| chat | string | 内容 |
| extra | string | |
| kvExtra | {[k: string]: string} |
响应数据:
| Name | Type | Description |
|---|---|---|
| rescode | number | 0:表示成功 |
| msg | string | 返回描述 |
【注】 (1)新业务接入,扩展字段值请使用kvExtra,不要使用extra; (2)如果是需要与移动端sdk进行互通的老业务,需要使用extra的情形,请与移动端SDK进行互通联调;
示例:
const await res = chatromm.send({
event: 'sendTextChat',
data: {
chat, extra, kvExtra
}
})
const unsubscribe = chatromm.subscribe(({name, res}) => {
console.log({
name, res
})
})
// 如果要取消该订阅
unsubscribe()
请求参数:Function 可以订阅多次,最多限制20次,每次的传入函数,会有以下对象数据:
| Name | Type | Description |
|---|---|---|
| name | string | 事件类型 |
| res | Object | 返回数据 |
响应数据:Function
执行返回函数,可以取消该订阅
接受事件类型,请参考以下文档中的接受消息部分中的事件名和返回数据
const unsubscribe = chatromm.subscribe(({name, res}) => {
if (name === 'TextChat') {
const {extra, uid, kvExtra} = res
console.log(res)
}
})
只订阅单播、群组、公屏三种消息事件
const unsubscribe = chatromm.subscribeMsgs(({name, res}) => {
//
})
// 如果要取消该订阅
unsubscribe()
请求参数:Function
| Name | Type | Description |
|---|---|---|
| name | string | 事件类型 |
| res | Object | 返回数据 |
响应数据:Function 执行返回函数,可以取消该订阅
请求参数:object
| Name | Type | Description |
|---|---|---|
| num? | number | 数量(默认10) |
| pos? | number | 起始点(默认0) |
响应数据:string[]
| Name | Type | Description |
|---|---|---|
| uids | string[] | 用户列表 |
FAQs
chatroom工具库
We found that @efox/chatroom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.