I'm trying SPDY for iOS app, which currently uses AFNetworking (2.1.0) to handle HTTP requests. Server side, I'm using Google App Engine (Checked with SPDYCheck) it's SPDY-friendly.
Here's how I integrated SPDY in my code.
I'm using AFHTTPRequestOperationManager
@interface MyClient : AFHTTPRequestOperationManager
And I embedded SPDY in initWithBaseURL:
- (id)initWithBaseURL:(NSURL *)url {
self = [super initWithBaseURL:url];
if (!self) {
return nil;
}
// SPDY Config
NSString *spdyURL = [NSString stringWithFormat:@"%@://%@:443",url.scheme, url.host];
[SPDYURLConnectionProtocol registerOrigin:spdyURL];
...
}
Note that my url is with format https://myapp.appspot.com/_ah/
So I reformat it when passing to SPDY registerOrigin:
spdyURL will look like https://myapp.appspot.com:443
I suppose that's all I need? But I wasn't able to send request after adding the SPDY code. Debug message showed the following error:
error response from api/users/v1/is_token_valid :
Error Domain=NSURLErrorDomain
Code=-1001
"The request timed out."
UserInfo=0xdc2c250 {NSErrorFailingURLStringKey=https://myapp.appspot.com/_ah/api/users/v1/is_token_valid?
user_token=[a_token],
NSErrorFailingURLKey=https://myapp.appspot.com/_ah/api/users/v1/is_token_valid?
user_token=[a_token],
NSLocalizedDescription=The request timed out., NSUnderlyingError=0xf270e60 "The request timed out."}
I have no clue at all. Hope someone with experience with SPDY on iOS could help!!