Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@testrtc/watchrtc-sdk

Package Overview
Dependencies
Maintainers
2
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@testrtc/watchrtc-sdk

gather WebRTC API traces and statistics

  • 1.29.1
  • npm
  • Socket score

Version published
Weekly downloads
3.9K
increased by70.35%
Maintainers
2
Weekly downloads
 
Created
Source

watchRTC enables application developers to collect, track and analyze telemetry and metrics of real users on any WebRTC application.

This is done by including our watchRTC SDK which connects to the testRTC backend and collects the relevant data.

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, you need to include and initialize our SDK.

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.

Use the following initialization sequence:

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 transparently to your application. The watchRTC parameter is needed to make this connection.

  • rtcApiKey - 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 (no emails or names for example)
  • 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's watchRTC servers
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 - this is useful when you don't have a direct/easy access to the RTCPeerConnection object:

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 after calling init() and before the creation of RTCPeerConnection objects:

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.

You can use watchRTC.disableDataCollection() and watchRTC.disableDataCollection() to control what data you want to send.

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

Keywords

FAQs

Package last updated on 16 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc