I want to listen for server side events and update accordingly using AFNetworking 3.0. I found info here nshipster.com/afnetworking-2
This is for AFNetworking 2.0.
This is what the code looks like for the 2.0 version,
NSURL *URL = [NSURL URLWithString:@"http://example.com"];
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:URL];
[manager GET:@"/resources" parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
[resources addObjectsFromArray:responseObject[@"resources"]];
[manager 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];
} failure:nil];
The code above seems to be what I am looking for but with using AFN 3.0.
Anyone have any ideas?