任何人都可以指出我使用AFNetworking
库与服务器进行HTTP持久连接的正确方向。我已经查看了以下代码:
NSURL *URL = [NSURL URLWithString:@"http://example.com"];
AFRocketClient *client = [[AFRocketClient alloc] init];
[client SUBSCRIBE:@"/resources" usingBlock:^(NSArray *operations, NSError *error) {
for (AFJSONPatchOperation *operation in operations) {
switch (operation.type) {
case AFJSONAddOperationType:
[resources addObject:operation.value];
break;
default:
break;
}
}
} error:nil];
来自https://github.com/AFNetworking/AFRocketClient
我觉得这不是自我解释???