Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Allow customization of the "request" module used by client API #137

Closed
rfk opened this issue Aug 15, 2013 · 2 comments
Closed

Allow customization of the "request" module used by client API #137

rfk opened this issue Aug 15, 2013 · 2 comments

Comments

@rfk
Copy link
Contributor

rfk commented Aug 15, 2013

I'd like to use the Client API code for writing a loadtest suite. To make this work well, I would need it to use a customized "request" module object that can monitor and report on each outgoing HTTP request.

I made a first pass at this in the following commit, but it's pretty inelegant:

007a390

You can see how I intend to use such functionality here:

4c1fca7#L2R14

@dannycoates @zaach thoughts on the best way to achieve such functionality?

@dannycoates
Copy link
Contributor

@rfk I don't see anything wrong with your approach, however an alternative would be to make ClientApi an EventEmitter. I've used that approach for diagnostics before, in poolee for instance.

Then you could do something like:

client.api.on('stat', function (stat) { runner.send('add_hit', stat) })

Off topic but I think the client module deserves some refactoring in general soon, once we get a feel for its usage.

@rfk
Copy link
Contributor Author

rfk commented Aug 15, 2013

EventEmitter +1, that sounds a lot cleaner from an API standpoint. I'll continue with my hacked up version for now, and we can consider a more holistic refactoring sometime soon.

vladikoff added a commit that referenced this issue Feb 17, 2017
fix(server): Fix the port binding. r=vladikoff
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants