Introducing: HappyCampfire, a Campfire framework for OS X and iOS

One of my favorite tools that I use at work is Campfire. If you haven’t heard of Campfire, it’s a group chat web app built by 37 signals. It’s very easy to use and has some fun features. One day I started playing around with the Campfire API to see what could be done and from that came the app I’m working on called HappyCampr. From that app, came the framework HappyCampfire.

HappyCampfire is an objective-c wrapper around most of the Campfire API. It has model objects like users, messages, and rooms. It should allow anyone familiar with Cocoa programming to get right to work on using the Campfire API. It is designed to work on both OS X and iOS but most of the work/testing has been on OS X.

I wanted to put this out there to help people make good innovative uses of Campfire, without having to deal with too many of the nitty gritty details. It’s definitely still a bit of a work in progress so feel free to fork it and send me a pull request if want to fix/add anything.

The framework is designed to be asynchronous and uses ASIHTTPRequest for the network communication. It also allows you to make use of Campfire’s streaming API to get message updates. The project includes a test app for OS X that will let you test all of the different parts of the framework.

To get started you’ll create an object like this

campfire = [[HappyCampfire alloc] initWithCampfireURL:@"https://YOUR_CAMPFIRE_URL.campfirenow.com"];
campfire.authToken = @"YOUR_AUTH_TOKEN";

[campfire sendText:@"Hello World" toRoom:@"ROOM_NUM" completionHandler:^(HCMessage *message, NSError *error){

   NSLog(@"%@", message);

}];

If you’re interested in using the streaming API that’s really easy too.


campfire.delegate = self;
[campfire startListeningForMessagesInRoom:@"ROOM_NUMBER"];

// Then you'll implement the CampfireResponseProtocol
-(void)messageReceived:(HCMessage *)message
{
   NSLog(@"Message: %@", message);
}

Check it out on GitHub

This entry was posted in Uncategorized and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>