Skip to content

Instantly share code, notes, and snippets.

@ligfx
Forked from miyagawa/gist:1227494
Created November 15, 2011 05:05
Show Gist options
  • Save ligfx/1366208 to your computer and use it in GitHub Desktop.
Save ligfx/1366208 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