@observertc/observer-js 1.0.1-eb834f5.0 → 1.0.1-f31d7a4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ObservedCall.d.ts +14 -0
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +57 -13
- package/lib/ObservedCertificate.d.ts +1 -0
- package/lib/ObservedCertificate.d.ts.map +1 -1
- package/lib/ObservedCertificate.js +8 -1
- package/lib/ObservedClient.d.ts +41 -9
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +129 -73
- package/lib/ObservedCodec.js +5 -1
- package/lib/ObservedDataChannel.d.ts +4 -0
- package/lib/ObservedDataChannel.d.ts.map +1 -1
- package/lib/ObservedDataChannel.js +33 -1
- package/lib/ObservedIceCandidate.js +5 -1
- package/lib/ObservedIceCandidatePair.d.ts +4 -0
- package/lib/ObservedIceCandidatePair.d.ts.map +1 -1
- package/lib/ObservedIceCandidatePair.js +33 -1
- package/lib/ObservedIceTransport.js +5 -1
- package/lib/ObservedInboundRtp.js +5 -1
- package/lib/ObservedInboundTrack.js +7 -3
- package/lib/ObservedMediaPlayout.js +5 -1
- package/lib/ObservedMediaSource.js +5 -1
- package/lib/ObservedOutboundRtp.js +5 -1
- package/lib/ObservedOutboundTrack.js +7 -3
- package/lib/ObservedPeerConnection.d.ts +10 -0
- package/lib/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/ObservedPeerConnection.js +117 -43
- package/lib/ObservedPeerConnectionTransport.js +5 -1
- package/lib/ObservedRemoteInboundRtp.js +5 -1
- package/lib/ObservedRemoteOutboundRtp.js +5 -1
- package/lib/ObservedTURN.d.ts +30 -0
- package/lib/ObservedTURN.d.ts.map +1 -0
- package/lib/ObservedTURN.js +54 -0
- package/lib/ObservedTurnServer.d.ts +25 -0
- package/lib/ObservedTurnServer.d.ts.map +1 -0
- package/lib/ObservedTurnServer.js +59 -0
- package/lib/Observer.d.ts +27 -21
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +69 -46
- package/lib/common/Middleware.js +5 -1
- package/lib/common/SingleExecutor.js +5 -1
- package/lib/common/logger.js +7 -2
- package/lib/common/types.js +2 -1
- package/lib/common/utils.js +13 -5
- package/lib/detectors/Detector.js +2 -1
- package/lib/detectors/Detectors.js +7 -3
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +41 -19
- package/lib/schema/{eventTypes.d.ts → ClientEventTypes.d.ts} +2 -2
- package/lib/schema/ClientEventTypes.d.ts.map +1 -0
- package/lib/schema/ClientEventTypes.js +38 -0
- package/lib/schema/{metaTypes.d.ts → ClientMetaTypes.d.ts} +2 -2
- package/lib/schema/ClientMetaTypes.d.ts.map +1 -0
- package/lib/schema/ClientMetaTypes.js +16 -0
- package/lib/schema/ClientSample.js +4 -1
- package/lib/scores/CalculatedScore.js +2 -1
- package/lib/scores/DefaultCallScoreCalculator.js +5 -1
- package/lib/scores/ScoreCalculator.js +2 -1
- package/lib/utils/CallUpdater.js +2 -1
- package/lib/utils/OnAllClientCallUpdater.js +5 -1
- package/lib/utils/RemoteTrackResolver.js +2 -1
- package/lib/utils/onAnyClientCallUpdater.js +5 -1
- package/package.json +1 -1
- package/src/ObservedCall.ts +51 -2
- package/src/ObservedCertificate.ts +4 -0
- package/src/ObservedClient.ts +127 -62
- package/src/ObservedDataChannel.ts +29 -0
- package/src/ObservedIceCandidatePair.ts +26 -0
- package/src/ObservedPeerConnection.ts +90 -10
- package/src/ObservedTURN.ts +80 -0
- package/src/ObservedTurnServer.ts +72 -0
- package/src/Observer.ts +81 -68
- package/src/index.ts +4 -0
- package/src/schema/{eventTypes.ts → ClientEventTypes.ts} +1 -1
- package/src/schema/{metaTypes.ts → ClientMetaTypes.ts} +1 -1
- package/tsconfig.json +3 -3
- package/lib/schema/eventTypes.d.ts.map +0 -1
- package/lib/schema/eventTypes.js +0 -35
- package/lib/schema/metaTypes.d.ts.map +0 -1
- package/lib/schema/metaTypes.js +0 -13
package/lib/ObservedCall.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type ObservedCallEvents = {
|
|
|
17
17
|
update: [];
|
|
18
18
|
newclient: [ObservedClient];
|
|
19
19
|
empty: [];
|
|
20
|
+
'not-empty': [];
|
|
20
21
|
close: [];
|
|
21
22
|
};
|
|
22
23
|
export declare interface ObservedCall {
|
|
@@ -33,16 +34,29 @@ export declare class ObservedCall<AppData extends Record<string, unknown> = Reco
|
|
|
33
34
|
readonly calculatedScore: CalculatedScore;
|
|
34
35
|
remoteTrackResolver?: RemoteTrackResolver;
|
|
35
36
|
callUpdater?: CallUpdater;
|
|
37
|
+
totalAudioBytesSent: number;
|
|
38
|
+
totalAudioBytesReceived: number;
|
|
39
|
+
totalVideoBytesSent: number;
|
|
40
|
+
totalVideoBytesReceived: number;
|
|
41
|
+
totalDataChannelBytesSent: number;
|
|
42
|
+
totalDataChannelBytesReceived: number;
|
|
43
|
+
numberOfPeerConnections: number;
|
|
44
|
+
numberOfInboundRtpStreams: number;
|
|
45
|
+
numberOfOutboundRtpStreams: number;
|
|
46
|
+
numberOfDataChannels: number;
|
|
47
|
+
maxNumberOfClients: number;
|
|
36
48
|
appData?: AppData;
|
|
37
49
|
closed: boolean;
|
|
38
50
|
started?: number;
|
|
39
51
|
ended?: number;
|
|
40
52
|
scoreCalculator: ScoreCalculator;
|
|
41
53
|
constructor(settings: ObservedCallSettings<AppData>, observer: Observer);
|
|
54
|
+
get numberOfClients(): number;
|
|
42
55
|
get score(): number | undefined;
|
|
43
56
|
close(): void;
|
|
44
57
|
getObservedClient<ClientAppData extends Record<string, unknown> = Record<string, unknown>>(clientId: string): ObservedClient<ClientAppData> | undefined;
|
|
45
58
|
createObservedClient<ClientAppData extends Record<string, unknown> = Record<string, unknown>>(settings: ObservedClientSettings<ClientAppData>): ObservedClient<ClientAppData>;
|
|
46
59
|
update(): void;
|
|
60
|
+
private _onClientUpdate;
|
|
47
61
|
}
|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/ObservedCall.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedCall = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
const ObservedClient_1 = require("./ObservedClient");
|
|
6
|
+
const DefaultCallScoreCalculator_1 = require("./scores/DefaultCallScoreCalculator");
|
|
7
|
+
const Detectors_1 = require("./detectors/Detectors");
|
|
8
|
+
const OnAllClientCallUpdater_1 = require("./utils/OnAllClientCallUpdater");
|
|
9
|
+
const onAnyClientCallUpdater_1 = require("./utils/onAnyClientCallUpdater");
|
|
10
|
+
class ObservedCall extends events_1.EventEmitter {
|
|
8
11
|
observer;
|
|
9
12
|
detectors;
|
|
10
13
|
callId;
|
|
@@ -15,6 +18,17 @@ export class ObservedCall extends EventEmitter {
|
|
|
15
18
|
};
|
|
16
19
|
remoteTrackResolver;
|
|
17
20
|
callUpdater;
|
|
21
|
+
totalAudioBytesSent = 0;
|
|
22
|
+
totalAudioBytesReceived = 0;
|
|
23
|
+
totalVideoBytesSent = 0;
|
|
24
|
+
totalVideoBytesReceived = 0;
|
|
25
|
+
totalDataChannelBytesSent = 0;
|
|
26
|
+
totalDataChannelBytesReceived = 0;
|
|
27
|
+
numberOfPeerConnections = 0;
|
|
28
|
+
numberOfInboundRtpStreams = 0;
|
|
29
|
+
numberOfOutboundRtpStreams = 0;
|
|
30
|
+
numberOfDataChannels = 0;
|
|
31
|
+
maxNumberOfClients = 0;
|
|
18
32
|
appData;
|
|
19
33
|
closed = false;
|
|
20
34
|
started;
|
|
@@ -26,14 +40,14 @@ export class ObservedCall extends EventEmitter {
|
|
|
26
40
|
this.setMaxListeners(Infinity);
|
|
27
41
|
this.callId = settings.callId;
|
|
28
42
|
this.appData = settings.appData;
|
|
29
|
-
this.scoreCalculator = new DefaultCallScoreCalculator(this);
|
|
30
|
-
this.detectors = new Detectors();
|
|
43
|
+
this.scoreCalculator = new DefaultCallScoreCalculator_1.DefaultCallScoreCalculator(this);
|
|
44
|
+
this.detectors = new Detectors_1.Detectors();
|
|
31
45
|
switch (settings.callUpdaterPolicy) {
|
|
32
46
|
case 'onAllClientsUpdate':
|
|
33
|
-
this.callUpdater = new OnAllClientCallUpdater(this);
|
|
47
|
+
this.callUpdater = new OnAllClientCallUpdater_1.OnAllClientCallUpdater(this);
|
|
34
48
|
break;
|
|
35
49
|
case 'onAnyClientUpdate':
|
|
36
|
-
this.callUpdater = new OnAnyClientCallUpdater(this);
|
|
50
|
+
this.callUpdater = new onAnyClientCallUpdater_1.OnAnyClientCallUpdater(this);
|
|
37
51
|
break;
|
|
38
52
|
}
|
|
39
53
|
switch (settings.remoteTrackResolvePolicy) {
|
|
@@ -41,6 +55,9 @@ export class ObservedCall extends EventEmitter {
|
|
|
41
55
|
break;
|
|
42
56
|
}
|
|
43
57
|
}
|
|
58
|
+
get numberOfClients() {
|
|
59
|
+
return this.observedClients.size;
|
|
60
|
+
}
|
|
44
61
|
get score() {
|
|
45
62
|
return this.calculatedScore.value;
|
|
46
63
|
}
|
|
@@ -61,8 +78,9 @@ export class ObservedCall extends EventEmitter {
|
|
|
61
78
|
throw new Error(`Call ${this.callId} is closed`);
|
|
62
79
|
if (this.observedClients.has(settings.clientId))
|
|
63
80
|
throw new Error(`Client with id ${settings.clientId} already exists`);
|
|
64
|
-
const result = new ObservedClient(settings, this);
|
|
65
|
-
const
|
|
81
|
+
const result = new ObservedClient_1.ObservedClient(settings, this);
|
|
82
|
+
const wasEmpty = this.observedClients.size === 0;
|
|
83
|
+
const onUpdate = () => this._onClientUpdate(result);
|
|
66
84
|
result.once('close', () => {
|
|
67
85
|
result.off('update', onUpdate);
|
|
68
86
|
this.observedClients.delete(settings.clientId);
|
|
@@ -72,12 +90,38 @@ export class ObservedCall extends EventEmitter {
|
|
|
72
90
|
});
|
|
73
91
|
result.on('update', onUpdate);
|
|
74
92
|
this.observedClients.set(settings.clientId, result);
|
|
93
|
+
this.maxNumberOfClients = Math.max(this.maxNumberOfClients, this.observedClients.size);
|
|
75
94
|
this.emit('newclient', result);
|
|
95
|
+
if (wasEmpty) {
|
|
96
|
+
this.emit('not-empty');
|
|
97
|
+
}
|
|
76
98
|
return result;
|
|
77
99
|
}
|
|
78
100
|
update() {
|
|
101
|
+
if (this.closed)
|
|
102
|
+
return;
|
|
103
|
+
this.numberOfInboundRtpStreams = 0;
|
|
104
|
+
this.numberOfOutboundRtpStreams = 0;
|
|
105
|
+
this.numberOfPeerConnections = 0;
|
|
106
|
+
this.numberOfDataChannels = 0;
|
|
107
|
+
for (const client of this.observedClients.values()) {
|
|
108
|
+
this.numberOfInboundRtpStreams += client.numberOfInboundRtpStreams;
|
|
109
|
+
this.numberOfOutboundRtpStreams += client.numberOfOutboundRtpStreams;
|
|
110
|
+
this.numberOfPeerConnections += client.numberOfPeerConnections;
|
|
111
|
+
this.numberOfDataChannels += client.numberOfDataChannels;
|
|
112
|
+
}
|
|
79
113
|
this.detectors.update();
|
|
80
114
|
this.scoreCalculator.update();
|
|
81
115
|
this.emit('update');
|
|
82
116
|
}
|
|
117
|
+
_onClientUpdate(client) {
|
|
118
|
+
this.callUpdater?.onClientUpdate(client);
|
|
119
|
+
this.totalAudioBytesReceived = client.deltaReceivedAudioBytes;
|
|
120
|
+
this.totalAudioBytesSent = client.deltaSentAudioBytes;
|
|
121
|
+
this.totalVideoBytesReceived = client.deltaReceivedVideoBytes;
|
|
122
|
+
this.totalVideoBytesSent = client.deltaSentVideoBytes;
|
|
123
|
+
this.totalDataChannelBytesReceived = client.deltaDataChannelBytesReceived;
|
|
124
|
+
this.totalDataChannelBytesSent = client.deltaDataChannelBytesSent;
|
|
125
|
+
}
|
|
83
126
|
}
|
|
127
|
+
exports.ObservedCall = ObservedCall;
|
|
@@ -13,6 +13,7 @@ export declare class ObservedCertificate implements CertificateStats {
|
|
|
13
13
|
attachments?: Record<string, unknown>;
|
|
14
14
|
constructor(timestamp: number, id: string, _peerConnection: ObservedPeerConnection);
|
|
15
15
|
get visited(): boolean;
|
|
16
|
+
getPeerConnection(): ObservedPeerConnection;
|
|
16
17
|
update(stats: CertificateStats): void;
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=ObservedCertificate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedCertificate.d.ts","sourceRoot":"","sources":["../src/ObservedCertificate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,qBAAa,mBAAoB,YAAW,gBAAgB;IAYnD,SAAS,EAAE,MAAM;IACjB,EAAE,EAAE,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAb1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzC,OAAO,CAAC,QAAQ,CAAS;IAEzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAG9B,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,EACA,eAAe,EAAE,sBAAsB;IAGzD,IAAW,OAAO,YAMjB;IAEM,MAAM,CAAC,KAAK,EAAE,gBAAgB;CAUrC"}
|
|
1
|
+
{"version":3,"file":"ObservedCertificate.d.ts","sourceRoot":"","sources":["../src/ObservedCertificate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,qBAAa,mBAAoB,YAAW,gBAAgB;IAYnD,SAAS,EAAE,MAAM;IACjB,EAAE,EAAE,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAb1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzC,OAAO,CAAC,QAAQ,CAAS;IAEzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAG9B,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,EACA,eAAe,EAAE,sBAAsB;IAGzD,IAAW,OAAO,YAMjB;IAEM,iBAAiB;IAIjB,MAAM,CAAC,KAAK,EAAE,gBAAgB;CAUrC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedCertificate = void 0;
|
|
4
|
+
class ObservedCertificate {
|
|
2
5
|
timestamp;
|
|
3
6
|
id;
|
|
4
7
|
_peerConnection;
|
|
@@ -19,6 +22,9 @@ export class ObservedCertificate {
|
|
|
19
22
|
this._visited = false;
|
|
20
23
|
return visited;
|
|
21
24
|
}
|
|
25
|
+
getPeerConnection() {
|
|
26
|
+
return this._peerConnection;
|
|
27
|
+
}
|
|
22
28
|
update(stats) {
|
|
23
29
|
this._visited = true;
|
|
24
30
|
this.timestamp = stats.timestamp;
|
|
@@ -29,3 +35,4 @@ export class ObservedCertificate {
|
|
|
29
35
|
this.attachments = stats.attachments;
|
|
30
36
|
}
|
|
31
37
|
}
|
|
38
|
+
exports.ObservedCertificate = ObservedCertificate;
|
package/lib/ObservedClient.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
4
|
-
import { ClientSample, ClientIssue } from './schema/ClientSample';
|
|
5
|
-
import * as MetaData from './schema/
|
|
4
|
+
import { ClientMetaData, ClientSample, ClientIssue, ExtensionStat } from './schema/ClientSample';
|
|
5
|
+
import * as MetaData from './schema/ClientMetaTypes';
|
|
6
6
|
import { ObservedCall } from './ObservedCall';
|
|
7
7
|
import { CalculatedScore } from './scores/CalculatedScore';
|
|
8
8
|
import { Detectors } from './detectors/Detectors';
|
|
@@ -19,6 +19,8 @@ export type ObservedClientEvents = {
|
|
|
19
19
|
];
|
|
20
20
|
close: [];
|
|
21
21
|
joined: [];
|
|
22
|
+
issue: [ClientIssue];
|
|
23
|
+
metaData: [ClientMetaData];
|
|
22
24
|
rejoined: [timestamp: number];
|
|
23
25
|
left: [];
|
|
24
26
|
usingturn: [boolean];
|
|
@@ -52,21 +54,51 @@ export declare class ObservedClient<AppData extends Record<string, unknown> = Re
|
|
|
52
54
|
usingTURN: boolean;
|
|
53
55
|
availableOutgoingBitrate: number;
|
|
54
56
|
availableIncomingBitrate: number;
|
|
57
|
+
totalInboundPacketsLost: number;
|
|
58
|
+
totalInboundPacketsReceived: number;
|
|
59
|
+
totalOutboundPacketsSent: number;
|
|
60
|
+
totalDataChannelBytesSent: number;
|
|
61
|
+
totalDataChannelBytesReceived: number;
|
|
62
|
+
totalDataChannelMessagesSent: number;
|
|
63
|
+
totalDataChannelMessagesReceived: number;
|
|
64
|
+
totalSentBytes: number;
|
|
65
|
+
totalReceivedBytes: number;
|
|
66
|
+
totalReceivedAudioBytes: number;
|
|
67
|
+
totalReceivedVideoBytes: number;
|
|
68
|
+
totalSentAudioBytes: number;
|
|
69
|
+
totalSentVideoBytes: number;
|
|
70
|
+
deltaReceivedAudioBytes: number;
|
|
71
|
+
deltaReceivedVideoBytes: number;
|
|
72
|
+
deltaSentAudioBytes: number;
|
|
73
|
+
deltaSentVideoBytes: number;
|
|
74
|
+
deltaDataChannelBytesSent: number;
|
|
75
|
+
deltaDataChannelBytesReceived: number;
|
|
76
|
+
deltaDataChannelMessagesSent: number;
|
|
77
|
+
deltaDataChannelMessagesReceived: number;
|
|
78
|
+
deltaInboundPacketsLost: number;
|
|
79
|
+
deltaInboundPacketsReceived: number;
|
|
80
|
+
deltaOutboundPacketsSent: number;
|
|
55
81
|
avgRttInMs?: number;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
82
|
+
sendingAudioBitrate: number;
|
|
83
|
+
sendingVideoBitrate: number;
|
|
84
|
+
receivingAudioBitrate: number;
|
|
85
|
+
receivingVideoBitrate: number;
|
|
86
|
+
numberOfInboundRtpStreams: number;
|
|
87
|
+
numberOfInbundTracks: number;
|
|
88
|
+
numberOfOutboundRtpStreams: number;
|
|
89
|
+
numberOfOutboundTracks: number;
|
|
90
|
+
numberOfDataChannels: number;
|
|
60
91
|
readonly mediaDevices: MetaData.MediaDeviceInfo[];
|
|
61
92
|
issues: ClientIssue[];
|
|
62
93
|
constructor(settings: ObservedClientSettings<AppData>, call: ObservedCall);
|
|
94
|
+
get numberOfPeerConnections(): number;
|
|
63
95
|
get score(): number | undefined;
|
|
64
96
|
close(): void;
|
|
65
97
|
accept(sample: ClientSample): void;
|
|
66
98
|
private _processClientEvent;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
99
|
+
processMetadata(metadata: ClientMetaData): void;
|
|
100
|
+
addIssue(issue: ClientIssue): void;
|
|
101
|
+
addExtensionStats(stats: ExtensionStat): void;
|
|
70
102
|
private _updatePeerConnection;
|
|
71
103
|
}
|
|
72
104
|
//# sourceMappingURL=ObservedClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedClient.d.ts","sourceRoot":"","sources":["../src/ObservedClient.ts"],"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CAAC,OAAO,CAAC,EAAkB,IAAI,EAAE,YAAY;IAShG,IAAW,uBAAuB,WAEjC;IAED,IAAW,KAAK,uBAEf;IAEM,KAAK;IASL,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAkEzC,OAAO,CAAC,mBAAmB;IAsCpB,eAAe,CAAC,QAAQ,EAAE,cAAc;IAuBxC,QAAQ,CAAC,KAAK,EAAE,WAAW;IAK3B,iBAAiB,CAAC,KAAK,EAAE,aAAa;IAI7C,OAAO,CAAC,qBAAqB;CA4C7B"}
|
package/lib/ObservedClient.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedClient = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
const ObservedPeerConnection_1 = require("./ObservedPeerConnection");
|
|
6
|
+
const logger_1 = require("./common/logger");
|
|
7
|
+
const ClientEventTypes_1 = require("./schema/ClientEventTypes");
|
|
8
|
+
const ClientMetaTypes_1 = require("./schema/ClientMetaTypes");
|
|
9
|
+
const utils_1 = require("./common/utils");
|
|
10
|
+
const Detectors_1 = require("./detectors/Detectors");
|
|
11
|
+
const logger = (0, logger_1.createLogger)('ObservedClient');
|
|
12
|
+
class ObservedClient extends events_1.EventEmitter {
|
|
10
13
|
call;
|
|
11
14
|
detectors;
|
|
12
15
|
clientId;
|
|
@@ -31,31 +34,40 @@ export class ObservedClient extends EventEmitter {
|
|
|
31
34
|
usingTURN = false;
|
|
32
35
|
availableOutgoingBitrate = 0;
|
|
33
36
|
availableIncomingBitrate = 0;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
totalInboundPacketsLost = 0;
|
|
38
|
+
totalInboundPacketsReceived = 0;
|
|
39
|
+
totalOutboundPacketsSent = 0;
|
|
40
|
+
totalDataChannelBytesSent = 0;
|
|
41
|
+
totalDataChannelBytesReceived = 0;
|
|
42
|
+
totalDataChannelMessagesSent = 0;
|
|
43
|
+
totalDataChannelMessagesReceived = 0;
|
|
44
|
+
totalSentBytes = 0;
|
|
45
|
+
totalReceivedBytes = 0;
|
|
46
|
+
totalReceivedAudioBytes = 0;
|
|
47
|
+
totalReceivedVideoBytes = 0;
|
|
48
|
+
totalSentAudioBytes = 0;
|
|
49
|
+
totalSentVideoBytes = 0;
|
|
50
|
+
deltaReceivedAudioBytes = 0;
|
|
51
|
+
deltaReceivedVideoBytes = 0;
|
|
52
|
+
deltaSentAudioBytes = 0;
|
|
53
|
+
deltaSentVideoBytes = 0;
|
|
54
|
+
deltaDataChannelBytesSent = 0;
|
|
55
|
+
deltaDataChannelBytesReceived = 0;
|
|
56
|
+
deltaDataChannelMessagesSent = 0;
|
|
57
|
+
deltaDataChannelMessagesReceived = 0;
|
|
58
|
+
deltaInboundPacketsLost = 0;
|
|
59
|
+
deltaInboundPacketsReceived = 0;
|
|
60
|
+
deltaOutboundPacketsSent = 0;
|
|
54
61
|
avgRttInMs;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
sendingAudioBitrate = 0;
|
|
63
|
+
sendingVideoBitrate = 0;
|
|
64
|
+
receivingAudioBitrate = 0;
|
|
65
|
+
receivingVideoBitrate = 0;
|
|
66
|
+
numberOfInboundRtpStreams = 0;
|
|
67
|
+
numberOfInbundTracks = 0;
|
|
68
|
+
numberOfOutboundRtpStreams = 0;
|
|
69
|
+
numberOfOutboundTracks = 0;
|
|
70
|
+
numberOfDataChannels = 0;
|
|
59
71
|
mediaDevices = [];
|
|
60
72
|
issues = [];
|
|
61
73
|
constructor(settings, call) {
|
|
@@ -64,7 +76,10 @@ export class ObservedClient extends EventEmitter {
|
|
|
64
76
|
this.setMaxListeners(Infinity);
|
|
65
77
|
this.clientId = settings.clientId;
|
|
66
78
|
this.appData = settings.appData;
|
|
67
|
-
this.detectors = new Detectors();
|
|
79
|
+
this.detectors = new Detectors_1.Detectors();
|
|
80
|
+
}
|
|
81
|
+
get numberOfPeerConnections() {
|
|
82
|
+
return this.observedPeerConnections.size;
|
|
68
83
|
}
|
|
69
84
|
get score() {
|
|
70
85
|
return this.calculatedScore.value;
|
|
@@ -80,13 +95,49 @@ export class ObservedClient extends EventEmitter {
|
|
|
80
95
|
if (this.closed)
|
|
81
96
|
throw new Error(`Client ${this.clientId} is closed`);
|
|
82
97
|
const now = Date.now();
|
|
98
|
+
const elapsedInMs = now - this.updated;
|
|
99
|
+
const elapsedInSeconds = elapsedInMs / 1000;
|
|
100
|
+
++this.acceptedSamples;
|
|
101
|
+
this.availableIncomingBitrate = 0;
|
|
102
|
+
this.availableOutgoingBitrate = 0;
|
|
103
|
+
this.deltaDataChannelBytesReceived = 0;
|
|
104
|
+
this.deltaDataChannelBytesSent = 0;
|
|
105
|
+
this.deltaDataChannelMessagesReceived = 0;
|
|
106
|
+
this.deltaDataChannelMessagesSent = 0;
|
|
107
|
+
this.deltaInboundPacketsLost = 0;
|
|
108
|
+
this.deltaInboundPacketsReceived = 0;
|
|
109
|
+
this.deltaOutboundPacketsSent = 0;
|
|
110
|
+
this.deltaReceivedAudioBytes = 0;
|
|
111
|
+
this.deltaReceivedVideoBytes = 0;
|
|
112
|
+
this.deltaSentAudioBytes = 0;
|
|
113
|
+
this.deltaSentVideoBytes = 0;
|
|
114
|
+
this.numberOfDataChannels = 0;
|
|
115
|
+
this.numberOfInboundRtpStreams = 0;
|
|
116
|
+
this.numberOfInbundTracks = 0;
|
|
117
|
+
this.numberOfOutboundRtpStreams = 0;
|
|
118
|
+
this.numberOfOutboundTracks = 0;
|
|
83
119
|
sample.clientEvents?.forEach(this._processClientEvent.bind(this));
|
|
84
|
-
sample.clientMetaItems?.forEach(this.
|
|
85
|
-
sample.clientIssues?.forEach(this.
|
|
120
|
+
sample.clientMetaItems?.forEach(this.processMetadata.bind(this));
|
|
121
|
+
sample.clientIssues?.forEach(this.addIssue.bind(this));
|
|
86
122
|
sample.peerConnections?.forEach(this._updatePeerConnection.bind(this));
|
|
87
|
-
sample.extensionStats?.forEach(this.
|
|
123
|
+
sample.extensionStats?.forEach(this.addExtensionStats.bind(this));
|
|
88
124
|
// emit new attachments?
|
|
89
125
|
this.attachments = sample.attachments;
|
|
126
|
+
this.totalDataChannelBytesReceived += this.deltaDataChannelBytesReceived;
|
|
127
|
+
this.totalDataChannelBytesSent += this.deltaDataChannelBytesSent;
|
|
128
|
+
this.totalDataChannelMessagesReceived += this.deltaDataChannelMessagesReceived;
|
|
129
|
+
this.totalDataChannelMessagesSent += this.deltaDataChannelMessagesSent;
|
|
130
|
+
this.totalInboundPacketsLost += this.deltaInboundPacketsLost;
|
|
131
|
+
this.totalInboundPacketsReceived += this.deltaInboundPacketsReceived;
|
|
132
|
+
this.totalOutboundPacketsSent += this.deltaOutboundPacketsSent;
|
|
133
|
+
this.totalReceivedAudioBytes += this.deltaReceivedAudioBytes;
|
|
134
|
+
this.totalReceivedVideoBytes += this.deltaReceivedVideoBytes;
|
|
135
|
+
this.totalSentAudioBytes += this.deltaSentAudioBytes;
|
|
136
|
+
this.totalSentVideoBytes += this.deltaSentVideoBytes;
|
|
137
|
+
this.receivingAudioBitrate = (this.deltaReceivedAudioBytes * 8) / (elapsedInSeconds);
|
|
138
|
+
this.receivingVideoBitrate = (this.totalReceivedVideoBytes * 8) / (elapsedInSeconds);
|
|
139
|
+
this.sendingAudioBitrate = (this.deltaSentAudioBytes * 8) / (elapsedInSeconds);
|
|
140
|
+
this.sendingVideoBitrate = (this.deltaSentVideoBytes * 8) / (elapsedInSeconds);
|
|
90
141
|
this.calculatedScore.value = sample.score;
|
|
91
142
|
this.detectors.update();
|
|
92
143
|
// emit update
|
|
@@ -98,15 +149,15 @@ export class ObservedClient extends EventEmitter {
|
|
|
98
149
|
}
|
|
99
150
|
_processClientEvent(event) {
|
|
100
151
|
switch (event.type) {
|
|
101
|
-
case
|
|
152
|
+
case ClientEventTypes_1.ClientEventTypes.CALL_STARTED: {
|
|
102
153
|
// update call timestamp if it's the first time
|
|
103
154
|
break;
|
|
104
155
|
}
|
|
105
|
-
case
|
|
156
|
+
case ClientEventTypes_1.ClientEventTypes.CALL_ENDED: {
|
|
106
157
|
// update call timestamp if it's the first time
|
|
107
158
|
break;
|
|
108
159
|
}
|
|
109
|
-
case
|
|
160
|
+
case ClientEventTypes_1.ClientEventTypes.CLIENT_JOINED: {
|
|
110
161
|
if (event.timestamp) {
|
|
111
162
|
if (!this.joinedAt) {
|
|
112
163
|
this.joinedAt = event.timestamp;
|
|
@@ -122,7 +173,7 @@ export class ObservedClient extends EventEmitter {
|
|
|
122
173
|
}
|
|
123
174
|
break;
|
|
124
175
|
}
|
|
125
|
-
case
|
|
176
|
+
case ClientEventTypes_1.ClientEventTypes.CLIENT_LEFT: {
|
|
126
177
|
if (event.timestamp) {
|
|
127
178
|
if (!this.leftAt) {
|
|
128
179
|
this.leftAt = event.timestamp;
|
|
@@ -132,50 +183,35 @@ export class ObservedClient extends EventEmitter {
|
|
|
132
183
|
break;
|
|
133
184
|
}
|
|
134
185
|
}
|
|
135
|
-
this.call.observer.
|
|
136
|
-
call: this.call,
|
|
137
|
-
client: this,
|
|
138
|
-
data: event,
|
|
139
|
-
});
|
|
186
|
+
this.call.observer.emit('client-event', this, event);
|
|
140
187
|
}
|
|
141
|
-
|
|
188
|
+
processMetadata(metadata) {
|
|
142
189
|
switch (metadata.type) {
|
|
143
|
-
case
|
|
144
|
-
this.browser = parseJsonAs(metadata.payload);
|
|
190
|
+
case ClientMetaTypes_1.ClientMetaTypes.BROWSER: {
|
|
191
|
+
this.browser = (0, utils_1.parseJsonAs)(metadata.payload);
|
|
145
192
|
break;
|
|
146
193
|
}
|
|
147
|
-
case
|
|
148
|
-
this.engine = parseJsonAs(metadata.payload);
|
|
194
|
+
case ClientMetaTypes_1.ClientMetaTypes.ENGINE: {
|
|
195
|
+
this.engine = (0, utils_1.parseJsonAs)(metadata.payload);
|
|
149
196
|
break;
|
|
150
197
|
}
|
|
151
|
-
case
|
|
152
|
-
this.platform = parseJsonAs(metadata.payload);
|
|
198
|
+
case ClientMetaTypes_1.ClientMetaTypes.PLATFORM: {
|
|
199
|
+
this.platform = (0, utils_1.parseJsonAs)(metadata.payload);
|
|
153
200
|
break;
|
|
154
201
|
}
|
|
155
|
-
case
|
|
156
|
-
this.operationSystem = parseJsonAs(metadata.payload);
|
|
202
|
+
case ClientMetaTypes_1.ClientMetaTypes.OPERATION_SYSTEM: {
|
|
203
|
+
this.operationSystem = (0, utils_1.parseJsonAs)(metadata.payload);
|
|
157
204
|
break;
|
|
158
205
|
}
|
|
159
206
|
}
|
|
160
|
-
this.call.observer.
|
|
161
|
-
call: this.call,
|
|
162
|
-
client: this,
|
|
163
|
-
data: metadata,
|
|
164
|
-
});
|
|
207
|
+
this.call.observer.emit('client-metadata', this, metadata);
|
|
165
208
|
}
|
|
166
|
-
|
|
167
|
-
this.
|
|
168
|
-
|
|
169
|
-
client: this,
|
|
170
|
-
data: issue,
|
|
171
|
-
});
|
|
209
|
+
addIssue(issue) {
|
|
210
|
+
this.emit('issue', issue);
|
|
211
|
+
this.call.observer.emit('client-issue', this, issue);
|
|
172
212
|
}
|
|
173
|
-
|
|
174
|
-
this.call.observer.
|
|
175
|
-
call: this.call,
|
|
176
|
-
client: this,
|
|
177
|
-
data: stats,
|
|
178
|
-
});
|
|
213
|
+
addExtensionStats(stats) {
|
|
214
|
+
this.call.observer.emit('client-extension-stats', this, stats);
|
|
179
215
|
}
|
|
180
216
|
_updatePeerConnection(sample) {
|
|
181
217
|
let observedPeerConnection = this.observedPeerConnections.get(sample.peerConnectionId);
|
|
@@ -183,12 +219,32 @@ export class ObservedClient extends EventEmitter {
|
|
|
183
219
|
if (!sample.peerConnectionId) {
|
|
184
220
|
return logger.warn(`ObservedClient received an invalid PeerConnectionSample (missing peerConnectionId field). ClientId: ${this.clientId}, CallId: ${this.call.callId}`, sample);
|
|
185
221
|
}
|
|
186
|
-
observedPeerConnection = new ObservedPeerConnection(sample.peerConnectionId, this);
|
|
222
|
+
observedPeerConnection = new ObservedPeerConnection_1.ObservedPeerConnection(sample.peerConnectionId, this);
|
|
187
223
|
observedPeerConnection.once('close', () => {
|
|
188
224
|
this.observedPeerConnections.delete(sample.peerConnectionId);
|
|
189
225
|
});
|
|
190
226
|
this.observedPeerConnections.set(sample.peerConnectionId, observedPeerConnection);
|
|
227
|
+
this.emit('newpeerconnection', observedPeerConnection);
|
|
191
228
|
}
|
|
192
229
|
observedPeerConnection.accept(sample);
|
|
230
|
+
this.deltaDataChannelBytesReceived += observedPeerConnection.deltaDataChannelBytesReceived;
|
|
231
|
+
this.deltaDataChannelBytesSent += observedPeerConnection.deltaDataChannelBytesSent;
|
|
232
|
+
this.deltaDataChannelMessagesReceived += observedPeerConnection.deltaDataChannelMessagesReceived;
|
|
233
|
+
this.deltaDataChannelMessagesSent += observedPeerConnection.deltaDataChannelMessagesSent;
|
|
234
|
+
this.deltaInboundPacketsLost += observedPeerConnection.deltaInboundPacketsLost;
|
|
235
|
+
this.deltaInboundPacketsReceived += observedPeerConnection.deltaInboundPacketsReceived;
|
|
236
|
+
this.deltaOutboundPacketsSent += observedPeerConnection.deltaOutboundPacketsSent;
|
|
237
|
+
this.deltaReceivedAudioBytes += observedPeerConnection.deltaReceivedAudioBytes;
|
|
238
|
+
this.deltaReceivedVideoBytes += observedPeerConnection.deltaReceivedVideoBytes;
|
|
239
|
+
this.deltaSentAudioBytes += observedPeerConnection.deltaSentAudioBytes;
|
|
240
|
+
this.deltaSentVideoBytes += observedPeerConnection.deltaSentVideoBytes;
|
|
241
|
+
this.availableIncomingBitrate += observedPeerConnection.availableIncomingBitrate;
|
|
242
|
+
this.availableOutgoingBitrate += observedPeerConnection.availableOutgoingBitrate;
|
|
243
|
+
this.numberOfDataChannels += observedPeerConnection.observedDataChannels.size;
|
|
244
|
+
this.numberOfInbundTracks += observedPeerConnection.observedInboundTracks.size;
|
|
245
|
+
this.numberOfOutboundRtpStreams += observedPeerConnection.observedOutboundRtps.size;
|
|
246
|
+
this.numberOfOutboundTracks += observedPeerConnection.observedOutboundTracks.size;
|
|
247
|
+
this.numberOfInboundRtpStreams += observedPeerConnection.observedInboundRtps.size;
|
|
193
248
|
}
|
|
194
249
|
}
|
|
250
|
+
exports.ObservedClient = ObservedClient;
|
package/lib/ObservedCodec.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedCodec = void 0;
|
|
4
|
+
class ObservedCodec {
|
|
2
5
|
timestamp;
|
|
3
6
|
id;
|
|
4
7
|
mimeType;
|
|
@@ -39,3 +42,4 @@ export class ObservedCodec {
|
|
|
39
42
|
this.attachments = stats.attachments;
|
|
40
43
|
}
|
|
41
44
|
}
|
|
45
|
+
exports.ObservedCodec = ObservedCodec;
|
|
@@ -15,6 +15,10 @@ export declare class ObservedDataChannel implements DataChannelStats {
|
|
|
15
15
|
messagesReceived?: number | undefined;
|
|
16
16
|
bytesReceived?: number | undefined;
|
|
17
17
|
attachments?: Record<string, unknown> | undefined;
|
|
18
|
+
deltaBytesSent: number;
|
|
19
|
+
deltaBytesReceived: number;
|
|
20
|
+
deltaMessagesSent: number;
|
|
21
|
+
deltaMessagesReceived: number;
|
|
18
22
|
appData?: Record<string, unknown>;
|
|
19
23
|
constructor(timestamp: number, id: string, _peerConnection: ObservedPeerConnection);
|
|
20
24
|
get visited(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedDataChannel.d.ts","sourceRoot":"","sources":["../src/ObservedDataChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEpF,qBAAa,mBAAoB,YAAW,gBAAgB;
|
|
1
|
+
{"version":3,"file":"ObservedDataChannel.d.ts","sourceRoot":"","sources":["../src/ObservedDataChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEpF,qBAAa,mBAAoB,YAAW,gBAAgB;IAqBnD,SAAS,EAAE,MAAM;IACjB,EAAE,EAAE,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAtBjC,OAAO,CAAC,QAAQ,CAAS;IAEzB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAA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