Skip to content

Commit

Permalink
Heroku deployment variaibles
Browse files Browse the repository at this point in the history
  • Loading branch information
cgriffin4 committed Apr 25, 2012
1 parent 95f8caf commit 38045a1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: node server.js
web: NODE_ENV=heroku node server.js
18 changes: 16 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,21 @@ var app = require('http').createServer(handler)
, fs = require('fs')

app.listen(process.env.PORT || 8001);
io.set('log level', 1); // reduce logging
process.env.NODE_ENV = process.env.NODE_ENV || 'c9'

// setup differently for heroku - websockets are not supported
io.configure('heroku', function(){
io.enable('browser client etag');
io.set('log level', 1);

io.set("transports", ["xhr-polling"]);
io.set("polling duration", 10);
});

io.configure('c9', function(){
io.set('log level', 1);
io.set('transports', ['websocket']);
});

function handler (req, res) {
fs.readFile('index.html',
Expand All @@ -23,7 +37,7 @@ io.sockets.on('connection', function (socket) {
socket.on('message', function (data) {
console.info(data);
//socket.broadcast.emit('response', "[ECHO] "+data);
io.sockets.emit('response', "[ECHO] "+data);
io.sockets.emit('response', "[ECHO] " + process.env.NODE_ENV +data);
});

// remove user
Expand Down

0 comments on commit 38045a1

Please sign in to comment.