ConnectivityTask runs as a background SceneGraph task and periodically pings the active server’s health endpoint to determine whether the app has internet access.
Health check endpoint
AppConstants.brs:
TIMEOUT_HEALTH = 2500ms to detect connectivity quickly without blocking the UI.
Check interval
The internal poll interval used insideConnectivityTask is 10000ms (10 seconds), hardcoded in the task loop:
NET_RETRY_MS = 30000 is defined in AppConstants.brs and is used by other parts of the app (such as error dialogs) as a suggested retry interval. The connectivity task itself uses its own fixed 10-second loop.DoCheck logic
On each tick,DoCheck() resolves the server to ping and calls GTV_PingServer():
hasInternet is set to false immediately.
Global state fields
| Field | Type | Description |
|---|---|---|
m.global.isOnline | boolean | Set by GTV_IsOnline() — reflects the Roku OS network interface state |
m.global.hasInternet | boolean | Set by the health ping result — true only if the server responds |
m.top.hasInternet for observers on the task itself.
m.global.isOnline reflects the Roku device’s network interface state (Wi-Fi or Ethernet is connected), while m.global.hasInternet reflects actual server reachability. Both must be checked for a fully healthy connection.State transitions
The task tracks the last connectivity state to avoid flooding the log with repeated messages:lastConnectivityState values:
| Value | Meaning |
|---|---|
"online" | Server ping succeeded |
"offline" | Server ping failed |
"missing_server" | No server URL could be resolved |
How the app reacts to connectivity changes
Session auth check skipped
Session auth check skipped
MainScene.OnSessionAuthTimer() checks both GTV_IsOnline() and m.global.hasInternet before running a background session re-auth. If either is false, the check is deferred:Playlist network error
Playlist network error
When
PlaylistTask gets HTTP code -1 (timeout/network down), it classifies the error as AUTH_REASON_NETWORK_DOWN and MainScene shows an offline error dialog with a retry option.Auth network error
Auth network error
When
AuthTask cannot reach the server, it sets result.authReason = AUTH_REASON_NETWORK_DOWN and returns immediately. MainScene shows the error screen.Immediate check trigger
Immediate check trigger
Other parts of the app can force an immediate connectivity check by setting
m.top.checkNow = true on the ConnectivityTask node. The task observes this field and calls DoCheck() immediately.Forced server apply
When the user switches servers in settings,MainScene.ApplyServerNow() resets connectivity state optimistically: