Created
March 5, 2015 18:31
-
-
Save guilleiguaran/7905f4f7ae65c456c1d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSURL *url = [NSURL URLWithString:@"ws://localhost:4000/ws"]; | |
// Opens connection to Phoenix | |
_phoenix = [[Phoenix alloc] initWithURL:url]; | |
[_phoenix setDelegate:self]; | |
[_phoenix open]; | |
// Creates, listens on, and joins channel | |
_channel = [[PhoenixChannel alloc] initWithTopic:@"locations:1" payload:nil withPhoenix:_phoenix]; | |
[_channel on:@"driver:location" handleEventBlock:^(id message) { | |
NSLog(@"Message - %@", message); | |
}]; | |
[_channel join]; | |
[_channel sendEvent:@"driver:location" payload:@{ @"location" : @"-47,11" }]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment