Skip to content
Browse files

Heroku deployment variaibles

  • Loading branch information...
1 parent 95f8caf commit 38045a1600a2ef0d2b89ef37db143abd973a180a @cgriffin4 committed Apr 25, 2012
Showing with 17 additions and 3 deletions.
  1. +1 −1 Procfile
  2. +16 −2 server.js
View
2 Procfile
@@ -1 +1 @@
-web: node server.js
+web: NODE_ENV=heroku node server.js
View
18 server.js
@@ -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',
@@ -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

0 comments on commit 38045a1

Please sign in to comment.
Something went wrong with that request. Please try again.