Class QosDiscoveryClient
Namespace: Unity.Networking.QoS
Syntax
public static class QosDiscoveryClient
Methods
GetQosServersAsync(String, Int32, String, Boolean)
Send a request to get a list of available Qos servers for a specific URI. Supports caching.
Declaration
public static UnityWebRequestAsyncOperation GetQosServersAsync(string uri, int timeout = 0, string etag = null, bool useGzip = false)
Parameters
Type | Name | Description |
---|---|---|
String | uri | The URI to send the request to |
Int32 | timeout | (optional) The amount of time (in seconds) to wait before timing out the request |
String | etag | (optional) ETag for cache control |
Boolean | useGzip | (optional) Enable gzip-encoded responses. This reduces data transfer, but costs extra cpu cycles. |
Returns
Type | Description |
---|---|
UnityWebRequestAsyncOperation | A UnityWebRequestAsyncOperation containing the UnityWebRequest for the Qos server query |
IsWebRequestNullOrFailed(UnityWebRequest)
Test to see if a UnityWebRequest is null or in a failure state
Declaration
public static bool IsWebRequestNullOrFailed(UnityWebRequest webRequest)
Parameters
Type | Name | Description |
---|---|---|
UnityWebRequest | webRequest | The UnityWebRequest to validate |
Returns
Type | Description |
---|---|
Boolean | True if UnityWebRequest is failed, false if not |
IsWebRequestRetryable(UnityWebRequest)
Test to see if a UnityWebRequest should be retried.
Declaration
public static bool IsWebRequestRetryable(UnityWebRequest webRequest)
Parameters
Type | Name | Description |
---|---|---|
UnityWebRequest | webRequest | The UnityWebRequest to validate |
Returns
Type | Description |
---|---|
Boolean | True if UnityWebRequest is failed, false if not |
TryGetEtag(UnityWebRequest, out String)
Try to parse an ETag from the headers of a UnityWebRequest
Declaration
public static bool TryGetEtag(UnityWebRequest webRequest, out string etag)
Parameters
Type | Name | Description |
---|---|---|
UnityWebRequest | webRequest | The UnityWebRequest to check for an ETag |
String | etag | The string to store the resulting ETag (null if not found) |
Returns
Type | Description |
---|---|
Boolean | True if header was found and could be parsed, false if not |
TryGetMaxAge(UnityWebRequest, out Int32)
Try to parse the Cache-Control header from a UnityWebRequest and return the max-age value
Declaration
public static bool TryGetMaxAge(UnityWebRequest webRequest, out int maxAge)
Parameters
Type | Name | Description |
---|---|---|
UnityWebRequest | webRequest | The UnityWebRequest to parse |
Int32 | maxAge | The value to store the resulting max-age value in (0 if failed) |
Returns
Type | Description |
---|---|
Boolean | True if header was found and could be parsed; false if not |
TryGetQosServersFromGzip(Byte[], out QosServer[], out String)
Declaration
public static bool TryGetQosServersFromGzip(byte[] gzipData, out QosServer[] qosServers, out string error)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | gzipData | |
QosServer[] | qosServers | |
String | error |
Returns
Type | Description |
---|---|
Boolean |
TryGetQosServersFromJsonString(String, out QosServer[], out String)
Try to populate a list of QosServers from a string representing the body of a previous GetQosServersAsync request
Declaration
public static bool TryGetQosServersFromJsonString(string jsonEncodedString, out QosServer[] qosServers, out string error)
Parameters
Type | Name | Description |
---|---|---|
String | jsonEncodedString | The body of the request to parse the list of QosServers from |
QosServer[] | qosServers | The array to store the resulting QosServers (null if failed) |
String | error | The string reference to receive any error (null on success). |
Returns
Type | Description |
---|---|
Boolean | True if parsing successful, false if not |
TryGetQosServersFromRequest(UnityWebRequest, out QosServer[], out String, Boolean)
Try to populate a list of QosServers from the response of a previous GetQosServersAsync request
Declaration
public static bool TryGetQosServersFromRequest(UnityWebRequest webRequest, out QosServer[] qosServers, out string error, bool useGzip = false)
Parameters
Type | Name | Description |
---|---|---|
UnityWebRequest | webRequest | The request to parse the list of QosServers from |
QosServer[] | qosServers | The array to store the resulting QosServers (null if failed) |
String | error | The string reference to receive any error (null on success). |
Boolean | useGzip | (optional) Enable decoding gzip-encoded responses. This reduces data transfer, but costs extra cpu cycles. |
Returns
Type | Description |
---|---|
Boolean | True if parsing successful, false if not |