Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
nunoguedelha committed Sep 21, 2021
1 parent b364ba6 commit 44ba79d
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions iCubTelemVizServer/iCubTelemVizServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ portRPCserver4sysCmds.onRead(function (cmdNparams) {
});

// Start history and realtime servers
app.listen(portTelemetryRespOrigin, function () {
const telemServer = app.listen(portTelemetryRespOrigin, function () {
console.log('ICubTelemetry History hosted at http://localhost:' + portTelemetryRespOrigin + '/history');
console.log('ICubTelemetry Realtime hosted at ws://localhost:' + portTelemetryRespOrigin + '/realtime');
});

// start the server!
http.listen(3000, function(){
const consoleServer = http.listen(3000, function(){
console.log('listening on http://localhost:3000');
});

Expand All @@ -163,3 +163,27 @@ var ret = openMctServerHandler.setNvmVersion('v14.17.0');
console.log(ret.status);
console.log(ret.message);
openMctServerHandler.start();

function closeServers(signal) {
console.log('Received '+'SIGINT'+' ...');
telemServer.close(() => {
console.log('iCub Telemetry Server Process terminated')
})
consoleServer.close(() => {
console.log('Control Console Server Process terminated')
})
openMctServerHandler.stop();
process.exit(2);
}

process.stdin.resume();

process.on('SIGINT', closeServers);
process.on('SIGTERM', closeServers);
process.on('SIGQUIT', closeServers);
process.on('SIGABRT', closeServers);

console.log(process.pid);
console.log('Is the process.stdin a tty.ReadStream instance currently configured to operate as a raw device? '+process.stdin.isRaw+'!');

process.abort();

0 comments on commit 44ba79d

Please sign in to comment.