You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
968 B
30 lines
968 B
4 years ago
|
var peo = (client, room)=>{
|
||
|
|
||
|
let lastAct = '';
|
||
|
|
||
|
setInterval(()=>{
|
||
|
let act = '';
|
||
|
if(typeof room.act != "undefined") act = (room.act.rate.toString().length>4?room.act.rate.toString().substring(0, 4):room.act.rate.toString());
|
||
|
else act = room.num.toString();
|
||
|
|
||
|
if(act != lastAct){
|
||
|
client.publish('peo/'+room.id, act);
|
||
|
lastAct = act;
|
||
|
}
|
||
|
}, 500);
|
||
|
/*
|
||
|
room.on('peopleIn', ()=>{
|
||
|
client.publish('peo/'+room.id, room.num.toString());
|
||
|
if(typeof room.act != "undefined") client.publish('act/'+room.id, (room.act.rate.toString().length>4?room.act.rate.toString().substring(0, 4):room.act.rate.toString()));
|
||
|
});
|
||
|
|
||
|
room.on('peopleOut', ()=>{
|
||
|
client.publish('peo/'+room.id, room.num.toString());
|
||
|
if(typeof room.act != "undefined") client.publish('act/'+room.id, (room.act.rate.toString().length>4?room.act.rate.toString().substring(0, 4):room.act.rate.toString()));
|
||
|
});
|
||
|
|
||
|
*/
|
||
|
}
|
||
|
|
||
|
exports.peo = peo;
|