Skip to content

Instantly share code, notes, and snippets.

@iamady
Created October 6, 2012 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamady/3845830 to your computer and use it in GitHub Desktop.
Save iamady/3845830 to your computer and use it in GitHub Desktop.
Nodejitsu App var app = express(); error
//Initialize the variables needed.
var express = require('express')
, http = require('http');
var app = express();
var server = http.createServer(app);
var io = require('socket.io').listen(server);
server.listen(80);
io.set('log level',1); //I put a level one to avoid too many non-application logs.
console.log('Application Running on http://localhost:80');
app.configure(function(){
//No use in layout views
app.set('view options', {
layout: false
});
//Indicates the directory of public access
app.use(express.static('public'));
});
//Setting the path and the view to show
app.get('/', function(req, res){
res.render('index.jade', {
pageTitle: 'drawMe'
});
});
//Connection has been established
io.sockets.on('connection', function(socket) {
/* When a user performs an action on the client, receives data from the particular stock and shipping to all other coordinates */
socket.on('mousemove',function(e){
//console.log('Drawing ...');
//io.sockets.emit('down',e);
socket.broadcast.emit('moving', e);
});
/* socket.on('closeLine',function(e){
console.log('stroke Terminated');
io.sockets.emit('up',e);
});
socket.on('draw',function(e){
io.sockets.emit('move',e);
});
socket.on('clean',function(){
console.log('Clean slate');
io.sockets.emit('clean',true);
});
*/
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment