Cocoa interface to the Juggernaut realtime/push service.
Objective-C C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
juggernaut-cocoa.xcodeproj
socketio-cocoa @ 8a8372d
.gitignore
.gitmodules
JuggernautClient.h
JuggernautClient.m
README.md
ZLIB-LICENSE
juggernaut-cocoa.1
juggernaut-cocoa.m
juggernaut-cocoa_Prefix.pch

README.md

Juggernaut for Cocoa

A Cocoa interface to Alex MacCaw's Juggernaut realtime push system. Works on Mac or iPhone.

You might find this a useful alternative to Apple's Push Notification Service for in-app push scenarios. This can work while running in the simulator, while Apple's push service only works on the real device.

NOTE: Juggernaut supports several different transports, but this uses just websocket.

Subscribing

JuggernautClient *client = [[JuggernautClient alloc] initWithHost:@"localhost" port:8080];

[client subscribe:@"channel1"];

Getting Messages

Incoming messages are posted as notifications. You'll add an observer...

[[NSNotificationCenter defaultCenter] addObserver:handler
                                         selector:@selector(didReceiveMessage:)
                                             name:JuggernautDidReceiveMessageNotification
                                           object:nil];

and handle the notification...

- (void)didReceiveMessage:(NSNotification *)notification {
    NSString *message = [notification object];

    // Message will look like {"data":"some message","channel":"channel1"}
    // and you can run this through your own JSON parser.
}

Depends on

Getting the code

If you have git 1.7+ ...

git clone git://github.com/fpotter/juggernaut-cocoa.git --recursive

or, earlier ...

git clone git://github.com/fpotter/juggernaut-cocoa.git juggernaut-cocoa
cd juggernaut-cocoa
git submodule init
git submodule update
cd socketio-cocoa
git submodule init
git submodule update

Adding to your project

Copy the AsyncSocket.h, AsyncSocket.m, WebSocket.h, WebSocket.m, SocketIoClient.h, SocketIoClient.m, JuggernautClient.h, JuggernautClient.m files to your project.

If you're building for iOS, make sure you add a reference to the CFNetwork framework or you'll see compile errors from AsyncSocket.