Skip to content

Instantly share code, notes, and snippets.

@arthurstomp
Created October 2, 2017 01:40
Show Gist options
  • Save arthurstomp/1b504528099976b2aeddccd8b680828f to your computer and use it in GitHub Desktop.
Save arthurstomp/1b504528099976b2aeddccd8b680828f to your computer and use it in GitHub Desktop.
var express = require('express')
var app = express();
var expressWs = require('express-ws')(app);
var si = require('systeminformation');
const port = 4000
var totalSubs = 0
app.ws('/sub', (ws, req) => {
totalSubs += 1;
console.log('Total subscriptions : '+totalSubs);
setInterval(() => {
si.processes(data => { ws.send(data.all) } )
}, 500)
ws.send('fetching...');
});
app.listen(port, () => {
console.log('Little server started on '+port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment