JSPM

@testrtc/watchrtc-sdk

1.28.9
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 9233
    • Score
      100M100P100Q155012F
    • License ISC

    gather WebRTC API traces and statistics

    Package Exports

    • @testrtc/watchrtc-sdk

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@testrtc/watchrtc-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    watchRTC offers users the ability to collect, track and analyze the metrics of real users on any WebRTC application.

    This is done by including our watchRTC SDK which connects to the testRTC backend.

    Installation

    via Yarn

    yarn add @testrtc/watchrtc-sdk

    via NPM

    npm install @testrtc/watchrtc-sdk

    via CDN

    <script src="https://unpkg.com/@testrtc/watchrtc-sdk/lib/index.js"></script>

    Usage

    Before any of your webrtc javascript code, add the following:

    javascript (ES6+)

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

    Typescript

    import watchRTC from "@testrtc/watchrtc-sdk";
    watchRTC.init();

    javascript (ES5+)

    with CDN

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <title>watchRT SDK</title>
      </head>
      <body>
        <script src="https://unpkg.com/@testrtc/watchrtc-sdk/lib/index.js"></script>
        <script>
          watchRTC.init();
        </script>
      </body>
    </html>

    This will transparently modify the RTCPeerConnection objects, allowing it to connect to the watchRTC backend service. The watchrtc parameter is needed to make this connection.

    • rtcApiKey - the watchRTC API key, as provided by testRTC
    • rtcRoomId - an identifier to the session/room/conference. This will enable an analysis of all participants in the same room as a single logical unit
    • rtcPeerId - an identifer of this peer/user in the session. This will make it easier to identify and troubleshoot users. It is recommended to use non-PII data here as much as possible
    • rtcTags - tags to associate with this peer connection. These can later be searched for or filtered
    • proxyUrl - (optional) secured web socket proxy server address, the proxy server should forward the connection to testRTC watch RTC server
    var pc = new RTCPeerConnection({
      ...,
      watchrtc:{
        rtcApiKey: "watchrtc api key",
        rtcRoomId: "identifier for the session",
        rtcPeerId: "identifier for the current peer",
        rtcTags: ["tag1", "tag2", "tag3"]
      }
    });

    Instead of calling

    watchRTC.init();

    you can use next approach

    watchRTC.init({
      rtcApiKey: "watchrtc api key",
      rtcRoomId: "identifier for the session",
      rtcPeerId: "identifier for the current peer",
      rtcTags: ["tag1", "tag2", "tag3"],
    });

    You also can use watchRTC.setConfig function to set watchrtc configuration

    watchRTC.setConfig({
      rtcApiKey: "watchrtc api key",
      rtcRoomId: "identifier for the session",
      rtcPeerId: "identifier for the current peer",
      rtcTags: ["tag1", "tag2", "tag3"],
    });

    This will override peerconnection and will use those values.

    Initialize SDK. Can be called multiple times but it will be initialized only at the first time.

    Samples

    https://github.com/testRTC/sample-Twilio-video-app-React-TypeScript-watchRTC