Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


proxy missing events from client request to returned stream #427

wants to merge 1 commit into from

2 participants

Roly Fentanes Mikeal Rogers
Roly Fentanes

A bunch of of events are missing from being emitted in the returned stream, socket, connect, upgrade, continue.

I'm only really interested in the socket event so I can use socket.emit('agentRemove') on it instead of having to increase the max sockets.

I'm aware I can also listen for the request event, which I can then listen to all of these events on. Wanted to know what you thought of this API design.

Thanks for an awesome library. :)

Mikeal Rogers

this doesn't merge cleanly, please reopen when it does.

Mikeal Rogers mikeal closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 5, 2013
  1. Roly Fentanes
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 0 deletions.
  1. +12 −0 main.js
12 main.js
@@ -779,6 +779,18 @@ Request.prototype.start = function () {
self.req.on('drain', function() {
+ self.req.on('socket', function(socket) {
+ self.emit('socket', socket);
+ });
+ self.req.on('connect', function(response, socket, head) {
+ self.emit('connect', response, socket, head);
+ });
+ self.req.on('upgrade', function(response, socket, head) {
+ self.emit('upgrade', response, socket, head);
+ });
+ self.req.on('continue', function() {
+ self.emit('continue');
+ });
self.on('end', function() {
if ( self.req.connection ) self.req.connection.removeListener('error', self._parserErrorHandler)
Something went wrong with that request. Please try again.