LAPReliableSessionManager 0.1.1

LAPReliableSessionManager 0.1.1

Maintained by Oliver Letterer.



 
Depends on:
AFNetworking~> 3.0
LAPWebServiceReachabilityManager~> 0.1
 

LAPReliableSessionManager

If you want to send data packages to a web service in a reliable way, with guaranteed delivery. LAPReliableSessionManager builds on top of AFNetworking and LAPWebServiceReachabilityManager. It first saves data packages to disk and then synchronizes them in a FIFO manner, one at a time.

Installation

LAPReliableSessionManager is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "LAPReliableSessionManager"

Usage

LAPWebServiceReachabilityManager *reachabilityManager = ...;
AFHTTPSessionManager *sessionManager = ...;

LAPReliableSessionManager *offlineStorage = [[LAPReliableSessionManager alloc] initWithService:@"de.layered-pieces.offline-storage" sessionManager:sessionManager reachabilityManager:reachabilityManager];

NSMutableURLRequest *request = [offlineStorage POST:@"/v1/endpoint" parameters:@{ @"json": @"dictionary" }];
[offlineStorage savePackage:request completion:^(NSURLRequest * _Nonnull request, NSURLResponse * _Nullable response, NSError * _Nullable error) {
    // delivery complete
}];