Skip to content

Conversation

@ipsi
Copy link

@ipsi ipsi commented Feb 19, 2015

Having been attempting to do some integration testing against a service that was using Twitters streaming API, I was hoping to use MockHTTP to do that, but it didn't work out so well, since as soon as the connection was closed, everything fell over in a horrible fashion. As such, I have made some modifications so that it is possible to create a connection to the mock service and have that connection stay open until we're done with it, and to send a "Keep Alive" chunk (basically a blank string) every so often.

This is my first draft of the code, so it might be a little wonky.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: configure your editor to use 2 space indents & avoid tabs.

@swankjesse
Copy link
Collaborator

I don't think we want this feature. You can already accomplish it with the throttled transfer, right?

@ipsi
Copy link
Author

ipsi commented Feb 23, 2015

@swankjesse Yes, you can, and this code only works by luck, so will close the pull request. I may raise another, smaller, one for adding some utility changes around this, though, and maybe some examples of how to do it, as it took me a while to click that it would always pause after writing out a set if bytes if the body was throttled, even if you'd written out the entire response - I'm not sure if that was intentional or not, which is what I needed: some way to keep the connection open for a second or two after writing out the body to give everything a chance to process.

@swankjesse
Copy link
Collaborator

Glad it's working for you. Thanks @ipsi. Looking forward to the follow up.

@swankjesse swankjesse closed this Feb 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants