TropoProvision now emits "end" when the response from Tropo ends #12

Merged
merged 9 commits into from Nov 16, 2012

Conversation

Projects
None yet
3 participants
Contributor

jharlap commented Feb 15, 2012

Before, TropoProvision.makeApiCall (used internally by all the TropoProvision methods) would emit responseCode and responseBody events, but there was no way for a consumer of the library to know when to stop expecting responseBody events - i.e., when the response was actually done.

This commit adds an 'end' event to TropoProvision which is called when we receive the end event on a request made against Tropo's servers.

Contributor

jharlap commented Feb 18, 2012

In retrospect, having used this a bit more now, I'm not sure this was the right approach. What would you think of changing it so that the data chunks are accumulated until the end is received, and then only emit responseBody on end? I think this is how the code in tropo-session works, and I'd be happy to submit a pull request with that change in tropo-provision.

Thoughts?

Contributor

mheadd commented Feb 20, 2012

I actually like that approach a bit better. I'll pull that in if you have a chance to make that change.

Thanks!

Contributor

jharlap commented Mar 25, 2012

Sorry for the delay, but I've made the change now so instead of emitting 'end', provisioning goes back to just emitting 'responseBody' but now accumulates chunks.

akalsey merged commit 33027e5 into tropo:master Nov 16, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment