topical media & game development
mobile-game-ch21-scribble-app.js / js
var express = require('express'),
app = express.createServer(),
io = require('socket.io').listen(app);
app.configure(function(){
app.use(express.static(__dirname + '/public'));
});
app.listen(3000);
// Clear the board every 60 seconds
setInterval(function() {
io.sockets.emit('clear');
},60000);
io.sockets.on('connection', function (socket) {
socket.on('paint',function(data) {
socket.broadcast.emit('paint', data);
});
socket.on('disconnect', function () {
console.log("Someone disconnected");
});
});
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.