AFNetwork-JSON-RPC-Client icon indicating copy to clipboard operation
AFNetwork-JSON-RPC-Client copied to clipboard

Suggestions for setting timeout

Open robreuss opened this issue 12 years ago • 1 comments

Hi -

Any suggestions for modifying time-out value for requests? Since no NSMutableRequest is sent into the methods, the normal way of modifying timeout with AFNetworking doesn't seem practical.

Thanks!

robreuss avatar Mar 27 '13 22:03 robreuss

Hi!

You can use this method https://github.com/AFNetworking/AFJSONRPCClient/blob/master/AFJSONRPCClient/AFJSONRPCClient.m#L88

Just extend it in your own client class and do something like:

- (NSMutableURLRequest *)requestWithMethod:(NSString *)method
                                parameters:(id)parameters
                                 requestId:(id)requestId
{
    ...
    NSMutableURLRequest *request = [self requestWithMethod:@"POST" path:[self.endpointURL absoluteString] parameters:payload];
    [request setTimeoutInterval:...];
    return request;
}

wiistriker avatar Mar 29 '13 12:03 wiistriker