Merge pull request #320 from indutny/master

Events patch
This commit is contained in:
Maciej Małecki 2012-10-23 12:59:33 -07:00
commit ebfdbede31
2 changed files with 13 additions and 3 deletions

View File

@ -437,6 +437,8 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
}
}
self.emit('websocket:start', req, socket, head, this.target);
//
// Helper function for setting appropriate socket values:
// 1. Turn of all bufferings

View File

@ -111,9 +111,17 @@ RoutingProxy.prototype.add = function (options) {
this.proxies[key].on('webSocketProxyError', this.emit.bind(this, 'webSocketProxyError'));
}
this.proxies[key].on('start', this.emit.bind(this, 'start'));
this.proxies[key].on('forward', this.emit.bind(this, 'forward'));
this.proxies[key].on('end', this.emit.bind(this, 'end'));
[
'start',
'forward',
'end',
'websocket:start',
'websocket:end',
'websocket:incoming',
'websocket:outgoing'
].forEach(function(event) {
this.proxies[key].on(event, this.emit.bind(this, event));
}, this);
};
//