API | Description |
Session management APIs | |
QUIC request configuration | |
Task management APIs | |
Request serialization APIs | |
Response serialization APIs |
API | Description |
A static method to construct a TQUICHTTPSessionManager instance. | |
Create a TQUICHTTPSessionManager instance with the specified configuration. For detailed configuration, see
TQUICURLSessionConfiguration | |
Create a TQUICHTTPSessionManager instance with the specified URL. | |
Initiate a GET request. | |
Initiate a POST request. |
+ (instancetype)manager
- (instancetype)initWithSessionConfiguration:(nullable %!s(<nil>) *)configuration
Parameter | Description |
configuration |
- (instancetype)initWithBaseURL:(nullable NSURL *)baseURL;- (instancetype)initWithBaseURL:(nullable NSURL *)baseURLsessionConfiguration:(nullable %!s(<nil>) *)configuration;
Parameter | Description |
baseURL | The request domain name. |
configuration |
- (nullable TQUICURLSessionDataTask *)GET:(NSString *)URLStringparameters:(nullable id)parametersheaders:(nullable NSDictionary <NSString *, NSString *> *)headerstimeoutInterval:(NSTimeInterval)timeoutIntervaldownloadProgress:(nullable %!s(<nil>))downloadProgresssuccess:(nullable %!s(<nil>))successfailure:(nullable %!s(<nil>))failure
Parameter | Description |
URLString | The request URL. |
parameters | The request parameters. |
headers | The request headers. |
timeoutInterval | The connection timeout. |
downloadProgress | The callback for download progress. |
success | The callback for request success. |
failure | The callback for request failure. |
- (nullable TQUICURLSessionDataTask *)POST:(NSString *)URLStringparameters:(nullable id)parametersheaders:(nullable NSDictionary <NSString *, NSString *> *)headerstimeoutInterval:(NSTimeInterval)timeoutIntervaluploadProgress:(nullable %!s(<nil>))uploadProgresssuccess:(nullable %!s(<nil>))successfailure:(nullable TQUICURLSessionTask)failure
Parameter | Description |
URLString | The request URL. |
parameters | The request parameters. |
headers | The request headers. |
timeoutInterval | The connection timeout. |
uploadProgress | The callback to be executed to get upload progress. |
success | The callback to be executed upon request success. |
failure | The callback to be executed upon request failure. |
typedef void (^TQUICURLSessionTaskSuccess)(%!s(<nil>) *task, id _Nullable responseObject)
Parameter | Description |
task | The request task. |
responseObject | The response data. |
typedef void (^TQUICURLSessionTaskFailure)(%!s(<nil>) * _Nullable task, NSError *error)
Parameter | Description |
task | The request task. |
error | The error message. |
API | Description |
Create an instance with the specified configuration. | |
Initiate requests with the NSURLRequest parameter. | |
Set the callback to collect statistics. | |
Set the callback block to receive request response. |
- (instancetype)initWithSessionConfiguration:(nullable %!s(<nil>) *)configuration
Parameter | Description |
configuration | QUIC request configuration. |
- (TQUICURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)requestuploadProgress:(nullable %!s(<nil>))uploadProgressdownloadProgress:(nullable %!s(<nil>))downloadProgresscompletionHandler:(nullable %!s(<nil>))completionHandler
Parameter | Description |
request | For detailed configuration, see NSURLRequest. |
uploadProgress | The callback to be executed to get upload progress. |
downloadProgress | The callback to be executed to get download progress. |
completionHandler | The callback to be executed upon request completion. |
- (void)setTaskDidFinishCollectingMetricsBlock:(nullable %!s(<nil>))block
Parameter | Description |
block | Execute the callback block to collect statistics when the request is complete. |
- (void)setTaskDidReceiveResponseBlock:(nullable %!s(<nil>))block
Parameter | Description |
block | Execute the callback block to receive request response. |
typedef void (^TQUICURLSessionTaskDidReceiveResponseBlock)(%!s(<nil>) *session, %!s(<nil>) *task, NSURLResponse *response)
Parameter | Description |
session | The class that manages sessions. |
task | The class that manages tasks. |
response | The response result. |
typedef void (^TQUICURLSessionTaskDownloadProgressBlock)(NSProgress *downloadProgress)
Parameter | Description |
downloadProgress | The download progress. |
typedef void (^TQUICURLSessionTaskUploadProgressBlock)(NSProgress *uploadProgress)
Parameter | Description |
uploadProgress | The upload progress. |
typedef void (^TQUICURLSessionTaskCompletionHandler)(NSURLResponse *response, id responseObject, NSError *error)
Parameter | Description |
response | For details about the response result, see NSURLResponse. |
responseObject | The response data. |
error | The error message. |
typedef void (^TQUICURLSessionTaskDidFinishCollectingMetricsBlock)(TQUICURLSession *session, TQUICURLSessionTask *task, TQUICURLSessionTaskMetrics * _Nullable metrics)
Parameter | Description |
session | Session management. |
task | Task management. |
metrics | The network statistics. |
Member variable | Description |
quicVersion | Set the QUIC version.
Supported versions: 043, Q046, Q050, Q051, draft-29, RFC-V1 (RFC 9000).
Values: TQUICVersionQ043 (default) TQUICVersion046 audio/video proxy TQUICVersion050 audio/video proxy TQUICVersion051 audio/video proxy TQUICVersionDraft29 audio/video proxy TQUICVersionRFCV1 audio/video proxy |
congestionType | Supported congestion algorithms: CubicBytes, RenoBytes, BBR, PCC, GCC. Values: TQUICCongestionTypeBBR (default) TQUICCongestionTypeCubicBytes TQUICCongestionTypeRenoBytes TQUICCongestionTypePCC TQUICCongestionTypeGCC |
connectTimeoutMillis | The connection timeout in milliseconds.
Default value: 60000. |
idleTimeoutMillis | The idle connection timeout in milliseconds. This setting will affect connection reuse.
Default value: 90000. |
ipv6Enabled audio/video proxy | Whether to support IPv6.
Values: YES, NO (default). |
dnsParser | The custom DNS parser. For details, see TQUICDNSParserDelegate. |
- (NSString *)lookup:(NSString *)hostName
Parameter | Description |
hostName | The domain name, which is called back to resolve an IP address. |
API | Description |
Create an instance with the specified configuration. | |
Create an instance with the default configuration. | |
Create a task with the request parameters. |
+ (instancetype)sessionWithConfiguration:(%!s(<nil>) *)configuration
Parameter | Description |
configuration | The QUIC request configuration. |
+ (instancetype)sharedSession
- (nullable %!s(<nil>) *)dataTaskWithRequest:(NSURLRequest *)request
Parameter | Description |
request | The request parameters. For more details, see NSURLRequest. |
- (void)resume
- (void)cancel
- (void)resume
- (void)cancel
API | Description |
Serialize HTTP request parameters. | |
Serialize JSON request parameters. |
API | Description |
Implement instantiation. | |
Set a value for the header field. | |
Return the value that corresponds to the header field. | |
Create NSMutableURLRequest. | |
Create NSMutableURLRequest to transfer streaming data. |
+ (instancetype)serializer
- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(NSString *)field
Parameter | Description |
value | The value of the header field. |
field | The name of the header field. |
- (nullable NSString *)valueForHTTPHeaderField:(NSString *)field
Parameter | Description |
field | The name of the header field. |
- (nullable NSMutableURLRequest *)requestWithMethod:(NSString *)methodURLString:(NSString *)URLStringparameters:(nullable id)parameterserror:(NSError * _Nullable __autoreleasing *)error
Parameter | Description |
method | Set the HTTP request method, such as GET, POST, PUT, DELETE, HEAD and PATCH. |
URLString | The request URL. |
parameters | The request parameters. |
error | The error message. |
- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)methodURLString:(NSString *)URLStringparameters:(nullable NSDictionary <NSString *, id> *)parametersconstructingBodyWithBlock:(nullable void (^)(id <%!s(<nil>)> formData))blockerror:(NSError * _Nullable __autoreleasing *)error
Parameter | Description |
method | Set the HTTP request method, such as GET, POST, PUT, DELETE, HEAD and PATCH. |
URLString | The request URL. |
parameters | The request parameters. |
constructingBodyWithBlock | Construct the body using the block. |
error | The error message. |
API | Description |
Create an instance. |
+ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions
Parameter | Description |
writingOptions | Create an instance with the JSON serialization options. |
API | Description |
Upload the form data with the specified file URL. | |
Upload the form data with the input stream. | |
Upload form data using multipart. | |
Add data parts. | |
Add the header fields and body data to the form. | |
The bandwidth limit for uploads. |
- (BOOL)appendPartWithFileURL:(NSURL *)fileURLname:(NSString *)nameerror:(NSError * _Nullable __autoreleasing *)error
Parameter | Description |
fileURL | Add the file URL to the form. |
name | The name of the associated file. |
error | The error message. |
- (void)appendPartWithInputStream:(nullable NSInputStream *)inputStreamname:(NSString *)namefileName:(NSString *)fileNamelength:(int64_t)lengthmimeType:(NSString *)mimeType
Parameter | Description |
inputStream | The input stream. |
name | The name of the input stream. |
fileName | The name of the file associated with the input stream. |
length | The length of the stream in bytes. |
mimeType | The MIME type, such as image/jpeg. For more details, see HTTP specifications. |
- (void)appendPartWithFileData:(NSData *)dataname:(NSString *)namefileName:(NSString *)fileNamemimeType:(NSString *)mimeType
Parameter | Description |
data | The data to be added to the form. |
name | The name of the associated data. |
fileName | The name of the associated file. |
mimeType | The MIME type, such as image/jpeg. For more details, see HTTP specifications. |
- (void)appendPartWithFormData:(NSData *)dataname:(NSString *)name
Parameter | Description |
data | The data to be added to the form. |
name | The name of the associated data. |
- (void)appendPartWithHeaders:(nullable NSDictionary <NSString *, NSString *> *)headersbody:(NSData *)body;
Parameter | Description |
headers | The headers to be added. |
body | The body data to be added. |
- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytesdelay:(NSTimeInterval)delay
Parameter | Description |
numberOfBytes | The maximum size of a packet in bytes. Default value: 16 KB. |
delay | The read delay for a packet. Default value: 0 seconds. |
API | Description |
Serialize HTTP response data. | |
Serialize JSON response data. |
API | Description |
Implement instantiation. | |
Validate the response data. |
+ (instancetype)serializer
- (BOOL)validateResponse:(nullable NSHTTPURLResponse *)responsedata:(nullable NSData *)dataerror:(NSError * _Nullable __autoreleasing *)error
Parameter | Description |
response | The response result to be validated. For more details, see NSHTTPURLResponse. |
data | The returned data. |
error | The validation error. |
API | Description |
Create an instance. |
+ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions
Parameter | Description |
serializerWithReadingOptions | Create an instance with the JSON serialization options. |
Property | Description |
transactionMetrics | An array of metrics for each request during the session. For more details, see TQUICURLSessionTaskTransactionMetrics. |
taskInterval | The time taken between when the task is created and when the task is completed. |
redirectCount | Number of redirects. |
Property | Description |
isValid | Whether the value of status is valid. |
isQuic | Whether it is a QUIC request. |
is0rtt | Whether it is a 0-RTT connection. |
isConnReuse | Whether the connection is reused. |
connectMillis | Get the connection duration in milliseconds. |
dnsMillis | Get the DNS duration in milliseconds. |
dnsCode | Get the DNS error code. |
ttfbMillis | Get the time taken for the first byte to be received in milliseconds. |
completeMillis | Get the time taken for the request to be completed in milliseconds. The time taken by the connection is not included. |
srttMicros | Get the average round-trip time in milliseconds. |
packetsSent | Get the number of packets sent in bytes. |
packetsRetransmitted | Get the number of packets retransmitted in bytes. |
bytesSent | Get the number of bytes sent. |
bytesRetransmitted | Get the number of bytes retransmitted. |
packetsLost | Get the number of packets lost in bytes. |
packetsReceived | Get the number of packets received in bytes. |
bytesReceived | Get the number of bytes received. |
streamBytesReceived | Get the number of bytes received within the stream. |
Was this page helpful?