Tinder: Listening is just as important as speaking
I just released an update to Tinder, the really unofficial Campfire API, that allows listening in on a room:
campfire = Tinder::Campfire.new 'mysubdomain'
campfire.login 'myemail@example.com', 'mypassword'
room = campfire.find_room_by_name 'Room 1'
messages = room.listen
#=> [{:person=>"Brandon", :message=>"I'm getting very sleepy", :user_id=>"148583", :id=>"16434003"}]
\#listen
takes an option block, which causes it to poll for new messages every 5 seconds and call the block for each message. It works great for heckling (ok, maybe that’s not the intent):
room.listen do |m|
room.speak "You're dumb!" if m[:person] == 'Brandon'
end
Check out my original post for more information about Tinder. Feedback and patches are welcome!
Thanks to Jesse Newland for the listening code.
This content is open source.
Suggest Improvements.