// Opens connection to Phoenix
_phoenix = [[Phoenix alloc] initWithURL:[NSURL URLWithString:@"ws://localhost:4000/ws"]];
[_phoenix setDelegate:self];
[_phoenix open];
// Creates, listens on, and joins channel
_channel = [[PhoenixChannel alloc] initWithTopic:@"channel:incoming" payload:nil withPhoenix:_phoenix];
[_channel on:@"response:event" handleEventBlock:^(id message) {
NSLog(@"Message - %@", message);
}];
[_channel join];
要运行示例项目,请克隆仓库,并首先从示例目录运行pod install
。
SocketRocket - 0.4.x
Josh Holtz,[email protected]
Phoenix-ObjC受MIT许可证的许可。有关更多信息,请参阅LICENSE文件。