mirror of
https://github.com/arnaucube/raspberryGPIOhtmlserver.git
synced 2026-02-08 04:06:43 +01:00
servidor funciona, gpio desabilitat
This commit is contained in:
21
node_modules/ws/examples/serverstats-express_3/server.js
generated
vendored
Executable file
21
node_modules/ws/examples/serverstats-express_3/server.js
generated
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
var WebSocketServer = require('../../').Server
|
||||
, http = require('http')
|
||||
, express = require('express')
|
||||
, app = express();
|
||||
|
||||
app.use(express.static(__dirname + '/public'));
|
||||
|
||||
var server = http.createServer(app);
|
||||
server.listen(8080);
|
||||
|
||||
var wss = new WebSocketServer({server: server});
|
||||
wss.on('connection', function(ws) {
|
||||
var id = setInterval(function() {
|
||||
ws.send(JSON.stringify(process.memoryUsage()), function() { /* ignore errors */ });
|
||||
}, 100);
|
||||
console.log('started client interval');
|
||||
ws.on('close', function() {
|
||||
console.log('stopping client interval');
|
||||
clearInterval(id);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user