Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Cocoa interface to the Juggernaut realtime/push service.
branch: master
Failed to load latest commit information.
juggernaut-cocoa.xcodeproj Initial commit.
socketio-cocoa @ 8a8372d
.gitignore Initial commit.
.gitmodules Updating socketio-cocoa module
JuggernautClient.h Initial commit.
JuggernautClient.m Initial commit.
README.md
ZLIB-LICENSE Initial commit.
juggernaut-cocoa.1 Initial commit.
juggernaut-cocoa.m Initial commit.
juggernaut-cocoa_Prefix.pch Initial commit.

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.

Something went wrong with that request. Please try again.