Setting up Socket.IO for production (It’s important!)

The socket.io.js file is big. If you want to use Socket.IO in a production environment, I strongly suggest you read this…
https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO

Here is the recommended setup for a production environment


io.configure('production', function(){
console.log(doodlr + " set config for production");
io.enable('browser client minification'); // send minified client
io.enable('browser client etag'); // apply etag caching logic based on version number
io.enable('browser client gzip'); // gzip the file
io.set('log level', 1); // reduce logging
io.set('transports', [ // enable all transports (optional if you want flashsocket)
'websocket'
, 'flashsocket'
, 'htmlfile'
, 'xhr-polling'
, 'jsonp-polling'
]);
});

run the following in terminal:

$ NODE_ENV=production node app.js

Join the Conversation

1 Comment

Your email address will not be published. Required fields are marked *

  1. Hi, Thanks for this useful information.
    But could you please add an article regarding switching from production to dev environment.
    Thanks