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.








11 comments
Excellent work Brandon! Our Campfire Bot, which we’ve lovingly named Elsington, is quite a good heckler. I’m interested to see what else comes of this.
January 27, 2007 at 08:50 AM
Having no luck with listen…
room.listen do |m| room.speak “Test” end
...nothing happens.
February 22, 2007 at 02:16 PM
Adam,
Hmm, I wonder if 37s deployed something that change how the polling works.
I’m not going to have time to look into it for a while, but patches are appreciated.
February 22, 2007 at 03:44 PM
Brandon & Adam,
37signals indeed did change something. I spoke to DHH a few minutes ago and he said they deployed a new build of campfire recently. My bot was working fine up until two days ago when they must have made the change.
February 23, 2007 at 04:22 PM
Huzzah!
I found the issue and I have emailed Brandon about it. I also found some other interesting stuff while digging around in the code.
I added a ping command in my version of tinder, that way if you set the bot to listen, he will ping every 60 seconds to stay logged in.
February 23, 2007 at 08:54 PM
Josh,
I modified line 121 of room.rb (0.1.3 via gems) so it returns the person name for enter/leave messages too, so now my bot can personally respond to anyone joining the room (or insult them for leaving).
Tim.
March 09, 2007 at 09:22 AM
Josh,
Did you figure out what has changed in the campfire API to break the marshmallow ‘watch’ command? I’d like to fix our scripts :)
Thanks, Tammer
April 08, 2007 at 07:03 PM
Here’s a patch against 0.1.4 that keeps Tinder alive for longer than a couple minutes:
http://pastie.caboo.se/129632
December 17, 2007 at 11:51 AM
Jesse,
Thanks for the patch. This was actually fixed in svn a few weeks ago, I just haven’t released a new version of the gem. Check it out and let me know how it works for you.
December 17, 2007 at 11:56 AM
I’m stumped on this one: I just added tinder as a publisher to cerberus and I want to be a good little programmer and include a functional test. How do I create a mock for Tinder?
December 20, 2007 at 11:42 PM
It’d be good if Tinder supported http authenticating proxies – one of the big benefits of campfire is that it works from inside corporate firewalls, but Tinder doesn’t handle this without modifications.
March 30, 2008 at 11:20 PM
We just deployed chat using this wonderful API on madmimi.com Thank you, thank you! It rocks.
April 25, 2008 at 12:16 PM
Speak your mind: