Knowledge Base

  1. Home
  2. Knowledge Base
  3. Technical Support
  4. Script Commands
  5. rtcSetNetworkProfile()


Change the network profile during a test run dynamically to simulate changing network conditions.


Name Type Description
profile name string The name of the network profile to set or

  • If the value is an empty string “”, then the network will return to its default state for the test
  • If the value “custom” is selected, then the additional optional arguments to this command will be required
parameter (optional) string “latency” or “packet loss”
value (optional) number The numerical value to set to the parameter:

  • For “latency”, this indicates the milliseconds of latency
  • For “packet loss”, this indicates the percentage of packet loss
direction (optional) string In which direction to apply the limitation: “in”, “out” or “both”
protocol (optional) string The transport protocol to apply the limitation on: “tcp”, “udp” or “both”


  • profile name should be the exact text of the network profiles that can be selected for tests
  • An empty string profile name will revert the network profile to its default state for the test
  • A “custom” profile can be used with the additional optional arguments
  • Applying multiple “custom” profiles one on top of the other will aggregate them

Code examples:

    .rtcSetNetworkProfile('Regular 4G')
    /* ... */
    /* connect session here */
    /* ... */

    /* Lower network conditions for 10 seconds */
    client.rtcSetNetworkProfile('Poor 3G')

    /* Drop the network altogether for 5 seconds */
    .rtcSetNetworkProfile('Call Drop')

    /* And back to the default again */

The script below runs a session for a full minute, then configures the network to 300kbps and 5% packet loss, and after an additional minute, reconfigures the network back to its default for an additional minute.

    // In the session
    .rtcScreenshot('hi there 1')

    // Limit network
    .rtcEvent('throttle', 'global')
    .rtcSetNetworkProfile('custom', 'packet loss', 5, 'both', 'both')

    // In the session
    .rtcScreenshot('hi there 2')
    // Back to normal
    .rtcSetNetworkProfile('') // back to pristine network conditions
    .rtcEvent('unthrottle', 'global')

    // In the session
    .rtcScreenshot('hi there 3')

Was this article helpful?

Related Articles

Leave a Reply 0 comments

Leave a Reply: