Sha256: ccc159151ecb49ecfe6554f48b080f8e3a09c9239e7ec6d051cc2c1e3aa07c17

Contents?: true

Size: 555 Bytes

Versions: 5

Compression:

Stored size: 555 Bytes

Contents

require 'http/parser'
require 'openssl'
require 'resolv'

module Twitter
  module Streaming
    class Connection

      def stream(request, response)
        client_context = OpenSSL::SSL::SSLContext.new
        client         = TCPSocket.new(Resolv.getaddress(request.uri.host), request.uri.port)
        ssl_client     = OpenSSL::SSL::SSLSocket.new(client, client_context)
        ssl_client.connect
        request.stream(ssl_client)
        while body = ssl_client.readpartial(1024)
          response << body
        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twitter-5.1.1 lib/twitter/streaming/connection.rb
twitter-5.1.0 lib/twitter/streaming/connection.rb
twitter-5.0.1 lib/twitter/streaming/connection.rb
twitter-5.0.0 lib/twitter/streaming/connection.rb
twitter-5.0.0.rc.1 lib/twitter/streaming/connection.rb