Last active
August 29, 2015 14:18
-
-
Save lancehudson/0fe3db3ddce38ffcff57 to your computer and use it in GitHub Desktop.
Test for PixMOB
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 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