Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
lean-cloud-chat
Advanced tools
settings:{
appId: 应用ID,
peerId: 当前用户的PeerID,
auth: 私聊签名函数(当平台设置启动签名后,需要传递),
groupAuth: 群组聊天签名函数(当平台设置启动签名后,需要传递),
watchingPeerIds: (非必须)
}
具体签名函数 需要类似下面的示例格式,基于 Promise 的异步操作。
function auth(peerId, watchingPeerIds){
// 类似
/*
return new Promise(resolve,reject){
//这里放ajax auth code
resolve({
watchingPeerIds: ajax返回值
});
}
*/
//这里实现了一个空函数
return Promise.resolve({
watchingPeerIds: watchingPeerIds||[]
});
}
function groupAuth(peerId, groupId, action, groupPeerIds){
return Promise.resolve({
groupPeerIds: groupPeerIds || []
});
}
实例化一个 消息客户端
打开链接,需要先执行上面的 new,
open().then(function(data){
//打开成功
})
所有方法都会返回promise then,因为都是异步执行,这样可以确认成功失败。
关闭链接
发送私聊消息 参数:msg:消息内容, to:发送目标 PeerId, transient(非必须):为true时代表无需离线,默认为支持离线发送。
send().then(function(data){
//success full send callback
},function(err){
//error callback
})
参数:peers:单个peerId 或数组。
参数:peers:单个peerId 或数组。
查询 peer 在线或离线状态。适应于非 watch 情况下。 参数:peers:单个peerId 或数组。
监听时间 参数:name:事件名称,func:事件处理函数
链接关闭
上线 当关注的人上线时触发
下线 当关注的人下线时触发
收到消息时触发
创建或加入群组 groupId: 群组Id,创建时无需传递。
发送消息到指定群组 msg:消息内容,grouipId:群组ID, transient(非必须):为true时代表无需离线,默认为支持离线发送。
邀请加入群组 groupId:群组ID,groupPeerIds:单个或数组群组ID
踢出群组 groupId:群组ID,groupPeerIds:单个或数组群组ID
离开群组 groupId:群组ID
有成员加入群
有成员离开群
自己加入了群
自己离开了群
直接启动一个 web 服务器 即可运行 demo。 对于不支持 websocket的浏览器 参考demo做法。 依赖 web-socket-js 可以用flash做 gateway
browserify chat.js -o lib/chat.js --exclude xmlhttprequest --exclude ws -s AVChatClient
FAQs
chat
The npm package lean-cloud-chat receives a total of 1 weekly downloads. As such, lean-cloud-chat popularity was classified as not popular.
We found that lean-cloud-chat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.