Skip to content

Instantly share code, notes, and snippets.

@jem-computer
Created February 10, 2014 12:58
Show Gist options
  • Save jem-computer/8915456 to your computer and use it in GitHub Desktop.
Save jem-computer/8915456 to your computer and use it in GitHub Desktop.
ObjectiveDDP + ReactiveCocoa
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[[NSNotificationCenter defaultCenter] rac_addObserverForName:MeteorClientDidConnectNotification object:nil] subscribeNext:^(id x) {
NSLog(@"connected to server!");
}];
[[[NSNotificationCenter defaultCenter] rac_addObserverForName:MeteorClientDidDisconnectNotification object:nil] subscribeNext:^(id x) {
NSLog(@"disconnected from server!");
}];
return YES;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reportConnection) name:MeteorClientDidConnectNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reportDisconnection) name:MeteorClientDidDisconnectNotification object:nil];
return YES;
}
- (void)reportConnection
{
NSLog(@"connected to server!");
}
- (void)reportDisconnection
{
NSLog(@"disconnected from server!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment