Commits

Rich Manalang [Atlassian] committed 27bc592

updated

  • Participants
  • Parent commits ed31858

Comments (0)

Files changed (1)

-
-/**
- * Module dependencies.
- */
-
 var express = require('express')
   , routes = require('./routes')
   , user = require('./routes/user')
   , http = require('http')
   , path = require('path')
-  , sio = require('socket.io');
-
-var app = express();
+  , sio = require('socket.io')
+  , app = express()
+  , server = http.createServer(app)
+  , io = sio.listen(server);
 
 app.configure(function(){
   app.set('port', process.env.PORT || 3000);
   app.set('views', __dirname + '/views');
   app.set('view engine', 'ejs');
+  app.set('photo_dir', process.env.PHOTO_DIR || '/public/photos')
   app.use(express.favicon());
   app.use(express.logger('dev'));
   app.use(express.bodyParser());
 app.get('/', routes.index);
 app.get('/users', user.list);
 
-var server = http.createServer(app);
-var io = sio.listen(server);
 server.listen(app.get('port'), function(){
   console.log("Express server listening on port " + app.get('port'));
 });
 
 io.sockets.on('connection', function(socket){
-    socket.emit('connect', {hello: 'world'});
-    socket.on('new', function(data){
-        console.log('new',data);
+    socket.emit('connect', {status: 'connected'});
+
+    // Listen for takePhoto event
+    socket.on('takePhoto', function(){
+      console.log('taking photo', arguments);
+      // trigger camera
     });
+
+    // Start watching photo dir
+    // on each new photo emit new event with filename
 });