Sha256: ef471b4487742cd8e9af0233461c26147594038eeb4751cdeb9b395261d0ab14

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 Bytes

Contents

require 'em-http'

module Rsift

  class Socket
  
    def self.perform(stream_identifier)
      endpoint = "ws://stream.datasift.net:8080/"
      EventMachine.run {
        http = EventMachine::HttpRequest.new(
            "#{endpoint}#{stream_identifier}").get(:timeout => 0)
    
        http.callback { puts "Connected to datasift" }
        http.errback { puts "something has failed" }
        http.disconnect { puts "oops, dropped connection?" }
    
        http.stream { |msg|
          yield msg
        }
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rsift-0.3.3 lib/rsift/socket.rb