roUrlTransfer with consistent headers, certificate handling, and timeout enforcement. All network calls in the app go through these helpers.
Constants (from AppConstants)
| Constant | Value | Description |
|---|---|---|
TIMEOUT_HTTP | 12000 ms | Default timeout for general HTTP calls |
TIMEOUT_AUTH | 15000 ms | Default timeout for auth requests |
TIMEOUT_HEALTH | 2500 ms | Timeout used by health-check pings |
RETRY_MAX | 3 | Maximum retry attempts |
CERTS | common:/certs/ca-bundle.crt | Certificate bundle path for HTTPS |
PLATFORM | roku | Value sent in the X-Platform header |
Functions
GTV_HttpGet
The full URL to request.
Timeout in milliseconds. Defaults to
15000. The request is cancelled and an error result is returned if no response arrives within this window.roAssociativeArray with the following fields:
| Field | Type | Description |
|---|---|---|
code | Integer | HTTP status code, or -1 on timeout / launch error |
body | String | Response body text |
ok | Boolean | true when code is in the 200–299 range |
GTV_HttpPost
The full URL to post to.
A JSON-encoded string to send as the request body. The
Content-Type: application/json header is set automatically.Timeout in milliseconds. Defaults to
15000.{code, body, ok} object as GTV_HttpGet.
Example
GTV_BuildQuery
GTV_UrlEncode.
An
roAssociativeArray of key/value pairs. Values are coerced to strings via .ToStr() before encoding.String query string without a leading ?, e.g. key1=val1&key2=val2.
Example
GTV_UrlEncode
roUrlTransfer.Escape.
Example
GTV_BuildUserAgent
User-Agent header string that is attached to every request made by GTV_HttpGet and GTV_HttpPost.
Optional
roDeviceInfo object. A new instance is created internally when invalid is passed.GTV_GetAppVersion
AppConstants().APP_VERSION. Falls back to "1.0.1" if the constant is missing or empty.
GTV_GetAppIdentity
AppConstants().APP_IDENTITY. Falls back to "GLOBALTV_ROKU".
Default headers
Every request created byGTV_HttpGet or GTV_HttpPost includes these headers:
Timeout and cancellation
BothGTV_HttpGet and GTV_HttpPost use roMessagePort with wait(timeoutMs, port). If the wait returns invalid (timeout), the transfer is cancelled with AsyncCancel() and the function returns {code: -1, body: "", ok: false}.
Certificate handling
HTTPS requests use the Roku system certificate bundle atcommon:/certs/ca-bundle.crt. This path is defined in AppConstants().CERTS and applied via SetCertificatesFile. The health-check helper (GTV_PingServer) only sets the certificate file when the URL starts with https.