安装
platform :ios, '7.0'
pod 'Courage', '~> 0.1.0'
TNTCourage *courage = [[TNTCourage alloc] initWithHost:host port:port tlsEnabled:@YES
providerId:providerId subscribeOptions:TNTCourageSubscribeOptionReplay
deviceId:[UIDevice currentDevice].identifierForVendor];
[courage setPublicKey:publicKey privateKey:privateKey];
[UIDevice currentDevice].identifierForVendor
是iOS上设置设备ID的推荐方式。channelId
。NSError *error;
[courage subscribeToChannel:channelId error:&error block:^(NSData *event) {
NSLog(@"%@", [[NSString alloc] initWithData:event encoding:NSUTF8StringEncoding]);
}];
publicKey
和privateKey
,则订阅将失败。开始连接
您还可以在连接后订阅其他频道。
[courage connect];
许可
CocoaPods是由以下人员创建的项目: