Skip to content

nodrStrategy Parameter

Description

The nodrStrategy parameter specifies the strategy for interaction between the Teleport SDK and specialized server-side network nodes — NODR (Node Delivery Resource).

NODRs are dedicated caching server nodes (edge nodes) in the Teleport Media infrastructure that serve as an intermediary tier between the peer-to-peer WebRTC network (browser peers) and the broadcaster's CDN/Origin server. NODRs can operate as high-performance participants in P2P exchange or as caching HTTP proxies prior to falling back to the CDN.

The nodrStrategy parameter is represented as a bitmask (integer number) composed of flags from the teleport.NodrStrategy enumeration. This allows flexible enabling or combining of specific mechanisms.

Default Behavior

By default, nodrStrategy is set to teleport.NodrStrategy.NO (0). Interaction with NODR nodes is disabled; the SDK only exchanges segments with standard browser peers over WebRTC and falls back directly to the CDN/Origin when data is unavailable in P2P.

teleport.NodrStrategy Enumeration

The teleport.NodrStrategy enumeration is available in the global teleport namespace and contains the following flags:

Flag NameValueBit ShiftDescription
NO00All NODR interaction mechanisms are disabled (default).
NODR_LOW_PRIORITY11 << 0Lower priority for NODR peers: browser peers are queried first.
NODR_EXTRA_CYCLE21 << 1Additional P2P download cycle from a NODR peer if the standard P2P cycle returned no data.
NODR_PROXY41 << 2Use NODR as an HTTP proxy before falling back to CDN.
NODR_BYTE_RANGE81 << 3Resume partial segment download via byte range (range query parameter).
ALL15Enable all NODR interaction mechanisms (1 | 2 | 4 | 8).

Detailed Description of Flags

NODR_LOW_PRIORITY (1)

Controls peer selection priority during P2P downloading.

  • Enabled: When selecting a peer for an upcoming segment, the SDK first queries standard browser peers (meta.type === "browser"). NODR nodes (meta.type === "nodr") are selected only if no eligible browser peers have the segment. This saves server NODR bandwidth and maximizes the P2P capacity of client devices.
  • Disabled: Peer selection is performed equally across all available peers without distinguishing between client and server peers.

NODR_EXTRA_CYCLE (2)

Activates an additional P2P download round targeted specifically at NODRs.

  • If the primary P2P cycle with browser peers fails to yield the segment, the SDK initiates an extra round targeting a NODR peer (via DataChannel or direct NODR URL) before falling back to external sources.

NODR_PROXY (4)

Enables HTTP proxying through NODRs before falling back to the CDN.

  • Enables background polling of active NODRs (requesting /v1/nodr/search every 10 minutes).
  • If a segment cannot be obtained from the P2P network, the SDK does not immediately request it from the CDN/Origin, but first attempts to download the segment over HTTP from an available NODR node.
  • In case of a timeout, the NODR has a 1/3 probability of being temporarily removed from rotation; on a 301 error, the NODR is forcefully disabled.

NODR_BYTE_RANGE (8)

Support for resuming partially downloaded segments.

  • If a download was interrupted but a portion of the payload was already received (payloadSize > 0), the SDK preserves the buffer and appends the range byte offset parameter (url?range=<payloadSize>).
  • The NODR responds with only the missing bytes, reducing network overhead and avoiding redundant traffic.

ALL (15)

A convenience constant enabling all flags:

javascript
teleport.NodrStrategy.ALL = 
    teleport.NodrStrategy.NODR_LOW_PRIORITY |
    teleport.NodrStrategy.NODR_EXTRA_CYCLE |
    teleport.NodrStrategy.NODR_PROXY |
    teleport.NodrStrategy.NODR_BYTE_RANGE;

Configuration Methods

1. Initialization via Teleport SDK

The strategy can be supplied in the config object of teleport.initialize():

javascript
let tlprt = await teleport.initialize({
    apiKey: "YOUR_API_KEY",
    config: {
        // Enable all NODR capabilities
        nodrStrategy: teleport.NodrStrategy.ALL
    },
    loader: {
        type: "PLUGIN_ID",
        params: { /* ... */ }
    }
});

2. Combining Specific Flags

Flags can be combined using the bitwise OR operator (|):

javascript
// Enable only HTTP proxying with byte range resumption and event telemetry
let tlprt = await teleport.initialize({
    apiKey: "YOUR_API_KEY",
    config: {
        nodrStrategy: teleport.NodrStrategy.NODR_PROXY
            | teleport.NodrStrategy.NODR_BYTE_RANGE
    },
    loader: {
        type: "PLUGIN_ID",
        params: { /* ... */ }
    }
});

3. Dynamic Runtime Modification

The Teleport instance provides a getter and setter for nodrStrategy:

javascript
// Read current strategy
console.log("Current NODR strategy:", tlprt.nodrStrategy);

// Check if a specific flag is active
let isProxyActive = (tlprt.nodrStrategy & teleport.NodrStrategy.NODR_PROXY) !== 0;

// Change strategy dynamically
tlprt.nodrStrategy = teleport.NodrStrategy.NODR_PROXY | teleport.NodrStrategy.NODR_BYTE_RANGE;

// Disable all NODR mechanisms
tlprt.nodrStrategy = teleport.NodrStrategy.NO;

4. Server-Side Configuration

Teleport supports centralized management of nodrStrategy via the management console or backend (config parameter ID 89). When updated from the server, the SDK automatically applies the new strategy without page reloads or client code changes.