Skip to content

Instantly share code, notes, and snippets.

@lancehudson
Last active August 29, 2015 14:18
Show Gist options
  • Save lancehudson/0fe3db3ddce38ffcff57 to your computer and use it in GitHub Desktop.
Save lancehudson/0fe3db3ddce38ffcff57 to your computer and use it in GitHub Desktop.
Test for PixMOB
var http = require('http');
var app = http.createServer(function(req, res) {
if(req.method === "POST") {
var body = "";
req.on('data', function (chunk) {
body += chunk;
});
req.on('end', function () {
io.emit('pixmob', "on");
setTimeout(function(){io.emit('pixmob', "off")}, 3000);
console.log(body);
res.writeHead(204);
res.end();
});
}
});
var io = require('socket.io')(app);
app.listen(8000);
setTimeout(function(){
console.log('on');
io.emit('pixmob', "on");
setTimeout(function(){io.emit('pixmob', "off "); console.log('off');}, 3000);
}, 6000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment