ObserveRTC Client Integration Core Library
!!! UNDER DEVELOPMENT, NO STABLE VERSION IS AVAILABLE AT THE MOMENT! !!!
@observertc/client-observer-js is a client side library for observertc integration.
Table of Contents:
Qucik Start
Install it from npm package repository.
npm i @observertc/client-observer-js
Collect WebRTC Stats
import { ClientObserver } from "@observertc/client-observer-js";
const config = {
collectingPeriodInMs: 5000,
};
const observer = ClientObserver.create(config);
observer.addStatsCollector({
id: "collectorId",
getStats: () => peerConnection.getStats(),
});
observer.events.onStatsCollected(() => {
for (const transport of observer.stats.transports()) {
console.log(transport.stats.packetsSent);
}
})
The above example collect stats in every 5s.
When stats are collected and stored it emits an event to notify the
application.
You can navigate through related stats:
for (const outboundRtp of observer.stats.outboundRtps()) {
const remoteInboundRtp = outboundRtp.getRemoteInboundRtp();
console.log(outboundRtp.stats, remoteInboundRtp.stats);
}
The example above shows how to get the remote inbound rtp stats related to the outbound rtp stats.
With stats
you accessing to the StatsStorage. StatsStorage provided entries can be used to navigate from stats type to another.

Sample and Send
UNDER DEVELOPMENT
API docs
https://observertc.github.io/client-observer-js/modules/ClientObserver.html
Schema
The schema used to send samples can be found here.
Configurations
const config = {
collectingPeriodInMs: 5000,
samplingPeriodInMs: 10000,
statsExpirationTimeInMs: 60000,
collectors: {
adapter: {
browserType: "chrome",
browserVersion: "97.1111.111",
},
},
sampler: {
roomId: "testRoom",
clientId: "clientId",
callId: "callId",
userId: "testUser",
incrementalSampling: true,
},
sender: {
format: "json",
websocket: {
urls: ["ws://localhost:7080/samples/myServiceId/myMediaUnitId"],
maxRetries: 1,
}
}
};
License
Apache-2.0