Created
October 2, 2017 01:40
-
-
Save arthurstomp/1b504528099976b2aeddccd8b680828f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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