Support & information center

Installing the watchRTC Javascript SDK


watchRTC requires you to integrate an SDK with your own running code. For that purpose, you will need to add the watchRTC Javascript SDK to your JS application

To start using the watchRTC JavaScript SDK library to collect WebRTC-related data from your web application, you need to perform a few basic tasks first. Then you can begin to log and analyze your data.

For integration with the SDK, you will first need to have a watchRTC API key. If you haven’t already done so, please make sure to create a watchRTC API key before you continue.

Install the SDK

Add the watchRTC JS SDK to your JS application using one of the following methods.

via NPM

yarn add @testrtc/watchrtc-sdk

via Yarn

yarn add @testrtc/watchrtc-sdk

via CDN

<script src=""></script>

Initialize the SDK

Once installed, to initialize our SDK, add the following setup code in your application, prior to using WebRTC APIs. To do this, use one of the following initialization sequences:

Note: The watchRTC.init() needs to take place prior to including or loading any 3rd party SDKs that interact with WebRTC. Failing to do so may hinder our ability to collect data!

javascript (ES6+)

const watchRTC = require("@testrtc/watchrtc-sdk");


import watchRTC from "@testrtc/watchrtc-sdk";

javascript (ES5+)

Using CDN.

<!DOCTYPE html>
<html lang="en">
    <title>watchRT SDK</title>
    <script src=""></script>

Once initialized, find where you create peer connections in your code and pass along the additional parameters necessary.


Open/Close connection to the server

By default, the watchRTC Javascript SDK will automatically establish a connection with the watchRTC server and close it after an idle period. At times, it might make sense for your application to manually open and close that connection explicitly. This is done by calling watchRTC.connect() and watchRTC.disconnect().

Read more about manually connecting/disconnecting to watchRTC servers.


Some things to remember:

Was this article helpful?

Related Articles