Skip to content

Instantly share code, notes, and snippets.

@taf2
Created July 10, 2011 19:38
Show Gist options
  • Save taf2/1074882 to your computer and use it in GitHub Desktop.
Save taf2/1074882 to your computer and use it in GitHub Desktop.
require 'goliath'
require 'em-http'
class SecureCallStream < Goliath::API
use Goliath::Rack::Params
def response(env)
src_url = 'http://remoteurl'
http = EM::HttpRequest.new(src_url).get
# TODO: filter chunks
http.stream { |chunk| env.chunked_stream_send(chunk) }
http.callback { env.chunked_stream_close }
chunked_streaming_response(200, {'Content-Type' => 'audio/wav'})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment