RBNetworkCenter Class Reference
Inherits from | NSObject |
---|---|
Declared in | RBNetworkCenter.h |
Overview
Centrally manages network connections.
- Manages their state.
- Enables their cancellation.
- Matches requests to prevent duplicate connections being made.
+ shared
The shared network center.
+ (nonnull RBNetworkCenter *)shared
Discussion
The shared network center.
Declared In
RBNetworkCenter.h
activeConnections
The number of currently active connections being managed.
@property (nonatomic, readonly) NSUInteger activeConnections
Discussion
The number of currently active connections being managed.
Declared In
RBNetworkCenter.h
– performRequest:completion:
Starts a network request.
- (nonnull id<RBCancellableTask>)performRequest:(nonnull NSURLRequest *)request completion:(nullable NetworkOperationCompletionBlock)completion
Parameters
request |
The request to perform. |
---|---|
completion |
The completion block to be called with the result when the operation concludes. |
Return Value
A handle that can be used to cancel the job.
Discussion
Starts a network request.
Declared In
RBNetworkCenter.h
– performRequest:beganReceivingResponse:progressUpdate:completion:
Starts a network request.
- (nonnull id<RBCancellableTask>)performRequest:(nonnull NSURLRequest *)request beganReceivingResponse:(nullable NetworkOperationBeganBlock)beganReceivingResponse progressUpdate:(nullable NetworkOperationProgressUpdateBlock)progressUpdate completion:(nullable NetworkOperationCompletionBlock)completion
Parameters
request |
The request to perform. |
---|---|
beganReceivingResponse |
A block called when the response begins, providing headers (optional). |
progressUpdate |
A block called to provide the progress receiving the response (optional). |
completion |
The completion block to be called with the result when the operation concludes. |
Return Value
A handle that can be used to cancel the job.
Discussion
Starts a network request.
Declared In
RBNetworkCenter.h