Sha256: b6fdb77bbaed943244b80bccc2ae866947d1a4fcfda254413d8f1eb9d3b5fa8d

Contents?: true

Size: 1.22 KB

Versions: 13

Compression:

Stored size: 1.22 KB

Contents

# twitter-stream

Simple Ruby client library for [twitter streaming API](http://apiwiki.twitter.com/Streaming-API-Documentation). 
Uses [EventMachine](http://rubyeventmachine.com/) for connection handling. Adheres to twitter's [reconnection guidline](http://apiwiki.twitter.com/Streaming-API-Documentation#Connecting).

JSON format only.

## Install

    sudo gem install twitter-stream -s http://gemcutter.org

## Usage

    require 'rubygems'
    require 'twitter/json_stream'
    
    EventMachine::run {
      stream = Twitter::JSONStream.connect(
        :path    => '/1/statuses/filter.json?track=football',
        :auth    => 'LOGIN:PASSWORD'
      )

      stream.each_item do |item|
        # Do someting with unparsed JSON item.
      end

      stream.on_error do |message|
        # No need to worry here. It might be an issue with Twitter. 
        # Log message for future reference. JSONStream will try to reconnect after a timeout.
      end
      
      stream.on_max_reconnects do |timeout, retries|
        # Something is wrong on your side. Send yourself an email.
      end
    }
    

## Examples

Open examples/reader.rb. Replace LOGIN:PASSWORD with your real twitter login and password. And
    ruby examples/reader.rb

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
twitter-stream-0.1.14 README.markdown
twitter-stream-0.1.13 README.markdown
twitter-stream-0.1.12 README.markdown
twitter-stream-0.1.11 README.markdown
twitter-stream-0.1.10 README.markdown
twitter-stream-0.1.9 README.markdown
twitter-stream-0.1.8 README.markdown
twitter-stream-0.1.7 README.markdown
twitter-stream-0.1.6 README.markdown
twitter-stream-0.1.4 README.markdown
twitter-stream-0.1.3 README.markdown
twitter-stream-0.1.2 README.markdown
twitter-stream-0.1.1 README.markdown