Skip to content

Instantly share code, notes, and snippets.

@saidimu
Forked from ligfx/gist:1366208
Created November 15, 2012 19:29
Show Gist options
  • Save saidimu/4080665 to your computer and use it in GitHub Desktop.
Save saidimu/4080665 to your computer and use it in GitHub Desktop.
monkeypatch socket.io to work with nginx with buffering on (e.g. dotcloud)
var monkeypatch = function(io) {
io.configure(function(){
io.set("transports", ["xhr-polling"]);
io.set("polling duration", 10);
});
io.handleRequest = _.wrap(io.handleRequest, function(next, req, res) {
res.writeHead = _.wrap(res.writeHead, function(next, status, headers) {
if (headers) { delete headers.Connection; }
return next.call(this, status, headers);
});
return next.call(this, req, res);
});
return io;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment