A和B通讯,这边通过for循环100次,A向B随机发送消息,测试了几次,发现跑不完这个循环就报错了。
Error: Command Timeout [cmd:2 op:null]
at createError (/Users/horsen/horsen_root/horsen_home/project/mynest/node_modules/leancloud-realtime/dist/realtime.js:2720:13)
at Timeout.onTimeout (/Users/horsen/horsenroot/horsen_home/project/mynest/node_modules/leancloud-realtime/dist/realtime.js:2816:28)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7) {
code: undefined,
appCode: undefined,
detail: undefined,
name: undefined
}
代码:
for(let i=0;i<count;i++){
let currentKeyword = keyword[Math.floor(Math.random()*keyword.length)];
this.myconversation.send(new TextMessage(currentKeyword)).then(function(message) {
console.log("NO:"+i+"次发送成功,这次的关键词为:"+currentKeyword);
}).catch(console.error);
}