Twitter api works with curl; but doesnt work with twitter-stream?

can anyone tell me why connecting to twitter using curl works and with
twitter-stream it doesnt (i am using the example code from the gem
website
on github:

using curl:
echo ‘track=software,ruby,rails,grails,torquebox,spring,tomcat,jboss’ >
track.in
curl -d @track.in
https://stream.twitter.com/1/statuses/filter.json-uUSERNAME:PASSWORD

everything works:

however when using twitter-stream; i get rejected (something with ssl;
however, i dont know why the curl client works)

require ‘rubygems’
require ‘twitter/json_stream’

username=‘user’
password=‘password’

username=ARGV[0] if ARGV[0]
password=ARGV[1] if ARGV[1]
auth="#{username}:#{password}"

puts “running twitter with auth => #{auth}”

EventMachine::run {
stream = Twitter::JSONStream.connect(
:path => ‘/1/statuses/filter.json’,
:auth => auth,
:method => ‘POST’,
#:ssl => true,
:content =>
‘track=software,ruby,rails,grails,torquebox,spring,tomcat,jboss’
)

stream.each_item do |item|
$stdout.print “item: #{item}\n”
$stdout.flush
end

stream.on_error do |message|
$stdout.print “error: #{message}\n”
$stdout.flush
end

stream.on_reconnect do |timeout, retries|
$stdout.print “reconnecting in: #{timeout} seconds\n”
$stdout.flush
end

stream.on_max_reconnects do |timeout, retries|
$stdout.print “Failed after #{retries} failed reconnects\n”
$stdout.flush
end

trap(‘TERM’) {
stream.stop
EventMachine.stop if EventMachine.reactor_running?
}
}
puts “The event loop has ended”


Thank You,
Matthew P.


Matthew P.
[email protected]
443.848.1595

“Lead, follow, or get out of the way.” – Thomas Paine
“Make everything as simple as possible, but not simpler.” – Albert
Einstein
“The definition of insanity is doing the same thing over and over and
expecting a different result.” – Benjamin Franklin
“We can’t solve problems by using the same kind of thinking we used when
we
created them.” – Albert Einstein

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs