Permalink
Browse files

Bugfix no socket.io-client js loader.

  • Loading branch information...
caio-ribeiro-pereira committed Sep 6, 2012
1 parent 6e2dfe1 commit f1108287ac86cb8bb349fd348af42da92988f423
Showing with 20 additions and 18 deletions.
  1. +20 −18 app.js
View
38 app.js
@@ -1,17 +1,27 @@
var express = require('express')
- , app = express()
+ , http = require('http')
+ , socket = require('socket.io')
, auth = require('./lib/auth')
- , server = require('http').createServer(app)
- , io = require('socket.io').listen(server);
+ , app = express();
-app.use(express.bodyParser());
-app.use(express.methodOverride());
-app.use(app.router);
-app.use(express.static(__dirname + '/public'));
-app.use(express.errorHandler());
-app.set('views', __dirname + '/views');
-app.set('view engine', 'jade');
+app.configure(function(){
+ app.set('view engine', 'jade');
+ app.set('views', __dirname + '/views');
+ app.use(express.bodyParser());
+ app.use(express.methodOverride());
+ app.use(express.cookieParser());
+ app.use(express.session({secret: 'exatec-nodejs'}));
+ app.use(app.router);
+ app.use(express.static(__dirname + '/public'));
+ app.use(express.errorHandler());
+});
+
+var port = (process.env.PORT || 3000);
+var server = http.createServer(app).listen(port, function() {
+ console.log("Executando Exatec Node.js");
+});
+var io = socket.listen(server);
app.get('/', function(req, res){
res.render('index', {host: 'http://' + req.headers.host});
@@ -27,10 +37,6 @@ app.post('/admin', function(req, res){
res.redirect('/');
});
-io.configure(function () {
- io.set("transports", ["xhr-polling"]);
- io.set("polling duration", 10);
-});
io.sockets.on('connection', function(socket){
socket.on('admin_connection', function(){
socket.broadcast.emit('admin_online');
@@ -45,7 +51,3 @@ io.sockets.on('connection', function(socket){
socket.broadcast.emit('admin_offline');
});
});
-
-app.listen((process.env.PORT || 3000), function() {
- console.log("Executando Exatec Node.js");
-});

0 comments on commit f110828

Please sign in to comment.