Add stats output from interactive client
parent
11de9a2dba
commit
dd49fa3ea6
|
|
@ -14,6 +14,14 @@ module.exports = async function()
|
|||
socket.pipe(process.stdout);
|
||||
|
||||
socket.on('connect', () => process.stdin.setRawMode(true));
|
||||
|
||||
socket.on('close', () => process.exit(0));
|
||||
socket.on('exit', () => socket.end());
|
||||
|
||||
if (process.argv && process.argv[2] === '--stats')
|
||||
{
|
||||
await socket.write('stats\n');
|
||||
|
||||
socket.end();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,9 +32,6 @@ class Interactive
|
|||
|
||||
openCommandConsole()
|
||||
{
|
||||
this.log('\n[opening Readline Command Console...]');
|
||||
this.log('type help to print available commands');
|
||||
|
||||
const cmd = readline.createInterface(
|
||||
{
|
||||
input : this._socket,
|
||||
|
|
@ -162,6 +159,13 @@ class Interactive
|
|||
break;
|
||||
}
|
||||
|
||||
case 'stats':
|
||||
{
|
||||
this.log(`rooms:${global.rooms.size}\npeers:${global.peers.size}`);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'dumpRooms':
|
||||
{
|
||||
for (const room of global.rooms.values())
|
||||
|
|
@ -571,14 +575,24 @@ class Interactive
|
|||
}
|
||||
|
||||
log(msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
this._socket.write(`${colors.green(msg)}\n`);
|
||||
}
|
||||
catch (error)
|
||||
{}
|
||||
}
|
||||
|
||||
error(msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
this._socket.write(`${colors.red.bold('ERROR: ')}${colors.red(msg)}\n`);
|
||||
}
|
||||
catch (error)
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
function runMediasoupObserver()
|
||||
|
|
|
|||
Loading…
Reference in New Issue