smart player afk detection added
This commit is contained in:
@@ -372,6 +372,7 @@ streamerServer.on('connection', function (ws, req) {
|
||||
ws.on('message', (msgRaw) => {
|
||||
|
||||
var msg;
|
||||
|
||||
try {
|
||||
msg = JSON.parse(msgRaw);
|
||||
} catch(err) {
|
||||
@@ -622,6 +623,13 @@ playerServer.on('connection', function (ws, req) {
|
||||
p.ws.send(playerCountMsg);
|
||||
}
|
||||
}
|
||||
|
||||
function sendPlayersLastInputTime() {
|
||||
let playerCountMsg = JSON.stringify({ type: 'lastOtherPlayerInput'});
|
||||
for (let p of players.values()) {
|
||||
p.ws.send(playerCountMsg);
|
||||
}
|
||||
}
|
||||
|
||||
ws.on('message', (msgRaw) =>{
|
||||
|
||||
@@ -659,6 +667,9 @@ playerServer.on('connection', function (ws, req) {
|
||||
} else if (msg.type == "peerDataChannelsReady") {
|
||||
msg.playerId = playerId;
|
||||
sendMessageToController(msg, skipSFU, true);
|
||||
} else if (msg.type == "playerInput") {
|
||||
//msg.playerId = playerId;
|
||||
sendPlayersLastInputTime();
|
||||
}
|
||||
else {
|
||||
console.error(`player ${playerId}: unsupported message type: ${msg.type}`);
|
||||
|
||||
Reference in New Issue
Block a user