I'm a new user of Typhoeus and I'm having a lot of fun. I'm using Typhoeus to connect to the Twitter Streaming API and it works great.
I'm looking for a way to cleanly terminate a streaming connection and I've scanned the documentation and searched the web but can't find anything on this particular topic. I've got an on_body callback defined that looks something like this:
request.on_body do |chunk|
# add chunk to buffer
# while messages exist in buffer
# add next message to queue for later processing
# !!! check for request to shutdown ; if shutdown requested, cleaning terminate streaming request and shutdown
I have a mechanism for contacting my program and requesting a shutdown, what I need help with is how do I tell Typhoeus that I'm done with the streaming connection. I don't want any more calls to on_body and instead I'd like the request to finish and the on_complete handler to fire.