@observertc/observer-js 1.0.1-4daea92.0 → 1.0.1-5a1b94b.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.
Files changed (144) hide show
  1. package/README.md +535 -1
  2. package/lib/ObservedCall.d.ts +18 -2
  3. package/lib/ObservedCall.d.ts.map +1 -1
  4. package/lib/ObservedCall.js +65 -11
  5. package/lib/ObservedCallEventMonitor.d.ts +14 -13
  6. package/lib/ObservedCallEventMonitor.d.ts.map +1 -1
  7. package/lib/ObservedCallEventMonitor.js +3 -1
  8. package/lib/ObservedClient.d.ts +9 -9
  9. package/lib/ObservedClient.d.ts.map +1 -1
  10. package/lib/ObservedClient.js +181 -15
  11. package/lib/ObservedClientEventMonitor.d.ts +54 -52
  12. package/lib/ObservedClientEventMonitor.d.ts.map +1 -1
  13. package/lib/ObservedClientEventMonitor.js +7 -0
  14. package/lib/ObservedTURN.d.ts +1 -1
  15. package/lib/ObservedTURN.d.ts.map +1 -1
  16. package/lib/ObservedTURN.js +1 -0
  17. package/lib/ObservedTurnServer.d.ts +2 -2
  18. package/lib/ObservedTurnServer.d.ts.map +1 -1
  19. package/lib/Observer.d.ts +6 -5
  20. package/lib/Observer.d.ts.map +1 -1
  21. package/lib/Observer.js +13 -20
  22. package/lib/ObserverEventMonitor.d.ts +45 -13
  23. package/lib/ObserverEventMonitor.d.ts.map +1 -1
  24. package/lib/ObserverEventMonitor.js +114 -1
  25. package/lib/common/ObserverSummary.d.ts.map +1 -0
  26. package/lib/common/types.d.ts +20 -0
  27. package/lib/common/types.d.ts.map +1 -1
  28. package/lib/index.d.ts +17 -17
  29. package/lib/index.d.ts.map +1 -1
  30. package/lib/index.js +16 -16
  31. package/lib/mediasoup/ObservedMediasoupRouter.d.ts +7 -0
  32. package/lib/mediasoup/ObservedMediasoupRouter.d.ts.map +1 -0
  33. package/lib/mediasoup/ObservedMediasoupRouter.js +12 -0
  34. package/lib/schema/ClientEventTypes.d.ts +147 -79
  35. package/lib/schema/ClientEventTypes.d.ts.map +1 -1
  36. package/lib/schema/ClientEventTypes.js +5 -2
  37. package/lib/schema/ClientSample.d.ts +1 -1
  38. package/lib/schema/ClientSample.d.ts.map +1 -1
  39. package/lib/updaters/OnAnyCallObserverUpdater.d.ts.map +1 -1
  40. package/lib/utils/MediasoupRemoteTrackResolver.d.ts +2 -2
  41. package/lib/utils/MediasoupRemoteTrackResolver.d.ts.map +1 -1
  42. package/lib/utils/RemoteTrackResolver.d.ts +2 -2
  43. package/lib/utils/RemoteTrackResolver.d.ts.map +1 -1
  44. package/lib/{ObservedCertificate.d.ts → webrtc/ObservedCertificate.d.ts} +1 -1
  45. package/lib/webrtc/ObservedCertificate.d.ts.map +1 -0
  46. package/lib/{ObservedCodec.d.ts → webrtc/ObservedCodec.d.ts} +1 -1
  47. package/lib/webrtc/ObservedCodec.d.ts.map +1 -0
  48. package/lib/{ObservedDataChannel.d.ts → webrtc/ObservedDataChannel.d.ts} +1 -1
  49. package/lib/webrtc/ObservedDataChannel.d.ts.map +1 -0
  50. package/lib/{ObservedIceCandidate.d.ts → webrtc/ObservedIceCandidate.d.ts} +1 -1
  51. package/lib/webrtc/ObservedIceCandidate.d.ts.map +1 -0
  52. package/lib/{ObservedIceCandidatePair.d.ts → webrtc/ObservedIceCandidatePair.d.ts} +3 -2
  53. package/lib/webrtc/ObservedIceCandidatePair.d.ts.map +1 -0
  54. package/lib/{ObservedIceCandidatePair.js → webrtc/ObservedIceCandidatePair.js} +17 -1
  55. package/lib/{ObservedIceTransport.d.ts → webrtc/ObservedIceTransport.d.ts} +1 -1
  56. package/lib/webrtc/ObservedIceTransport.d.ts.map +1 -0
  57. package/lib/{ObservedInboundRtp.d.ts → webrtc/ObservedInboundRtp.d.ts} +2 -2
  58. package/lib/webrtc/ObservedInboundRtp.d.ts.map +1 -0
  59. package/lib/{ObservedInboundTrack.d.ts → webrtc/ObservedInboundTrack.d.ts} +5 -4
  60. package/lib/webrtc/ObservedInboundTrack.d.ts.map +1 -0
  61. package/lib/{ObservedInboundTrack.js → webrtc/ObservedInboundTrack.js} +2 -1
  62. package/lib/{ObservedMediaPlayout.d.ts → webrtc/ObservedMediaPlayout.d.ts} +2 -2
  63. package/lib/webrtc/ObservedMediaPlayout.d.ts.map +1 -0
  64. package/lib/{ObservedMediaSource.d.ts → webrtc/ObservedMediaSource.d.ts} +2 -2
  65. package/lib/webrtc/ObservedMediaSource.d.ts.map +1 -0
  66. package/lib/{ObservedOutboundRtp.d.ts → webrtc/ObservedOutboundRtp.d.ts} +2 -2
  67. package/lib/webrtc/ObservedOutboundRtp.d.ts.map +1 -0
  68. package/lib/{ObservedOutboundTrack.d.ts → webrtc/ObservedOutboundTrack.d.ts} +5 -4
  69. package/lib/webrtc/ObservedOutboundTrack.d.ts.map +1 -0
  70. package/lib/{ObservedOutboundTrack.js → webrtc/ObservedOutboundTrack.js} +2 -1
  71. package/lib/{ObservedPeerConnection.d.ts → webrtc/ObservedPeerConnection.d.ts} +26 -4
  72. package/lib/webrtc/ObservedPeerConnection.d.ts.map +1 -0
  73. package/lib/{ObservedPeerConnection.js → webrtc/ObservedPeerConnection.js} +80 -17
  74. package/lib/{ObservedPeerConnectionTransport.d.ts → webrtc/ObservedPeerConnectionTransport.d.ts} +1 -1
  75. package/lib/webrtc/ObservedPeerConnectionTransport.d.ts.map +1 -0
  76. package/lib/{ObservedRemoteInboundRtp.d.ts → webrtc/ObservedRemoteInboundRtp.d.ts} +2 -2
  77. package/lib/webrtc/ObservedRemoteInboundRtp.d.ts.map +1 -0
  78. package/lib/{ObservedRemoteOutboundRtp.d.ts → webrtc/ObservedRemoteOutboundRtp.d.ts} +2 -2
  79. package/lib/webrtc/ObservedRemoteOutboundRtp.d.ts.map +1 -0
  80. package/package.json +1 -1
  81. package/src/ObservedCall.ts +70 -17
  82. package/src/ObservedCallEventMonitor.ts +17 -14
  83. package/src/ObservedClient.ts +195 -22
  84. package/src/ObservedClientEventMonitor.ts +59 -51
  85. package/src/ObservedTURN.ts +2 -1
  86. package/src/ObservedTurnServer.ts +2 -2
  87. package/src/Observer.ts +22 -27
  88. package/src/ObserverEventMonitor.ts +167 -14
  89. package/src/common/types.ts +20 -1
  90. package/src/index.ts +18 -19
  91. package/src/mediasoup/ObservedMediasoupRouter.ts +12 -0
  92. package/src/schema/ClientEventTypes.ts +187 -83
  93. package/src/schema/ClientSample.ts +1 -1
  94. package/src/updaters/OnAnyCallObserverUpdater.ts +1 -1
  95. package/src/utils/MediasoupRemoteTrackResolver.ts +2 -2
  96. package/src/utils/RemoteTrackResolver.ts +2 -2
  97. package/src/{ObservedCertificate.ts → webrtc/ObservedCertificate.ts} +1 -1
  98. package/src/{ObservedCodec.ts → webrtc/ObservedCodec.ts} +1 -1
  99. package/src/{ObservedDataChannel.ts → webrtc/ObservedDataChannel.ts} +1 -1
  100. package/src/{ObservedIceCandidate.ts → webrtc/ObservedIceCandidate.ts} +1 -1
  101. package/src/{ObservedIceCandidatePair.ts → webrtc/ObservedIceCandidatePair.ts} +19 -3
  102. package/src/{ObservedIceTransport.ts → webrtc/ObservedIceTransport.ts} +1 -1
  103. package/src/{ObservedInboundRtp.ts → webrtc/ObservedInboundRtp.ts} +2 -2
  104. package/src/{ObservedInboundTrack.ts → webrtc/ObservedInboundTrack.ts} +6 -4
  105. package/src/{ObservedMediaPlayout.ts → webrtc/ObservedMediaPlayout.ts} +2 -2
  106. package/src/{ObservedMediaSource.ts → webrtc/ObservedMediaSource.ts} +2 -2
  107. package/src/{ObservedOutboundRtp.ts → webrtc/ObservedOutboundRtp.ts} +2 -2
  108. package/src/{ObservedOutboundTrack.ts → webrtc/ObservedOutboundTrack.ts} +6 -4
  109. package/src/{ObservedPeerConnection.ts → webrtc/ObservedPeerConnection.ts} +122 -37
  110. package/src/{ObservedPeerConnectionTransport.ts → webrtc/ObservedPeerConnectionTransport.ts} +1 -1
  111. package/src/{ObservedRemoteInboundRtp.ts → webrtc/ObservedRemoteInboundRtp.ts} +2 -2
  112. package/src/{ObservedRemoteOutboundRtp.ts → webrtc/ObservedRemoteOutboundRtp.ts} +2 -2
  113. package/lib/ObservedCertificate.d.ts.map +0 -1
  114. package/lib/ObservedCodec.d.ts.map +0 -1
  115. package/lib/ObservedDataChannel.d.ts.map +0 -1
  116. package/lib/ObservedIceCandidate.d.ts.map +0 -1
  117. package/lib/ObservedIceCandidatePair.d.ts.map +0 -1
  118. package/lib/ObservedIceTransport.d.ts.map +0 -1
  119. package/lib/ObservedInboundRtp.d.ts.map +0 -1
  120. package/lib/ObservedInboundTrack.d.ts.map +0 -1
  121. package/lib/ObservedMediaPlayout.d.ts.map +0 -1
  122. package/lib/ObservedMediaSource.d.ts.map +0 -1
  123. package/lib/ObservedOutboundRtp.d.ts.map +0 -1
  124. package/lib/ObservedOutboundTrack.d.ts.map +0 -1
  125. package/lib/ObservedPeerConnection.d.ts.map +0 -1
  126. package/lib/ObservedPeerConnectionTransport.d.ts.map +0 -1
  127. package/lib/ObservedRemoteInboundRtp.d.ts.map +0 -1
  128. package/lib/ObservedRemoteOutboundRtp.d.ts.map +0 -1
  129. package/lib/ObserverSummary.d.ts.map +0 -1
  130. /package/lib/{ObserverSummary.d.ts → common/ObserverSummary.d.ts} +0 -0
  131. /package/lib/{ObserverSummary.js → common/ObserverSummary.js} +0 -0
  132. /package/lib/{ObservedCertificate.js → webrtc/ObservedCertificate.js} +0 -0
  133. /package/lib/{ObservedCodec.js → webrtc/ObservedCodec.js} +0 -0
  134. /package/lib/{ObservedDataChannel.js → webrtc/ObservedDataChannel.js} +0 -0
  135. /package/lib/{ObservedIceCandidate.js → webrtc/ObservedIceCandidate.js} +0 -0
  136. /package/lib/{ObservedIceTransport.js → webrtc/ObservedIceTransport.js} +0 -0
  137. /package/lib/{ObservedInboundRtp.js → webrtc/ObservedInboundRtp.js} +0 -0
  138. /package/lib/{ObservedMediaPlayout.js → webrtc/ObservedMediaPlayout.js} +0 -0
  139. /package/lib/{ObservedMediaSource.js → webrtc/ObservedMediaSource.js} +0 -0
  140. /package/lib/{ObservedOutboundRtp.js → webrtc/ObservedOutboundRtp.js} +0 -0
  141. /package/lib/{ObservedPeerConnectionTransport.js → webrtc/ObservedPeerConnectionTransport.js} +0 -0
  142. /package/lib/{ObservedRemoteInboundRtp.js → webrtc/ObservedRemoteInboundRtp.js} +0 -0
  143. /package/lib/{ObservedRemoteOutboundRtp.js → webrtc/ObservedRemoteOutboundRtp.js} +0 -0
  144. /package/src/{ObserverSummary.ts → common/ObserverSummary.ts} +0 -0
package/README.md CHANGED
@@ -1,2 +1,536 @@
1
- Server side component for monitoring WebRTC applications and services
1
+ # ObserverTC - Observer JS
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/@observertc/observer-js.svg)](https://www.npmjs.com/package/@observertc/observer-js)
4
+ [![License](https://img.shields.io/npm/l/@observertc/observer-js.svg)](https://github.com/observertc/observer-js/blob/main/LICENSE)
5
+
6
+ `observer-js` is a Node.js library for monitoring WebRTC client data. It processes statistical samples from clients, organizes them into calls and participants, tracks a wide range of metrics, detects common issues, and calculates quality scores. This enables real-time insights into WebRTC session performance.
7
+
8
+ This library is a core component of the ObserverTC ecosystem, designed to provide robust server-side monitoring capabilities for WebRTC applications.
9
+
10
+ ## Features
11
+
12
+ - **Hierarchical Data Model**: Organizes data into `Observer` -> `ObservedCall` -> `ObservedClient` -> `ObservedPeerConnection` and further into streams and data channels.
13
+ - **Comprehensive Metrics**: Tracks a wide array of WebRTC statistics including RTT, jitter, packet loss, codecs, ICE states, TURN usage, bandwidth, and more.
14
+ - **Automatic Entity Management**: Can automatically create and manage call and client entities based on incoming data samples.
15
+ - **Issue Detection**: Built-in detectors for common WebRTC problems.
16
+ - **Quality Scoring**: Calculates quality scores for calls and clients.
17
+ - **Event-Driven**: Emits events for significant state changes, new entities, and detected issues.
18
+ - **Configurable Update Policies**: Flexible control over how and when metrics are processed and updated.
19
+ - **TypeScript Support**: Written in TypeScript, providing strong typing and intellisense.
20
+ - **Extensible**: Supports custom application data (`appData`) and integration with external schema definitions (e.g., `observertc/schemas`).
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ npm install @observertc/observer-js
26
+ # or
27
+ yarn add @observertc/observer-js
28
+ ```
29
+
30
+ ## Quick Start
31
+
32
+ ```typescript
33
+ import { Observer, ObserverConfig } from '@observertc/observer-js';
34
+ import { ClientSample } from '@observertc/schemas'; // Assuming you use the official schemas
35
+
36
+ // 1. Configure the Observer
37
+ const observerConfig: ObserverConfig = {
38
+ updatePolicy: 'update-on-interval',
39
+ updateIntervalInMs: 5000, // Update observer every 5 seconds
40
+ defaultCallUpdatePolicy: 'update-on-any-client-updated', // Calls update when any client sends data
41
+ };
42
+ const observer = new Observer(observerConfig);
43
+
44
+ // 2. Listen to events
45
+ observer.on('newcall', (call) => {
46
+ console.log(`[Observer] New call detected: ${call.callId}`);
47
+
48
+ call.on('newclient', (client) => {
49
+ console.log(`[Call: ${call.callId}] New client joined: ${client.clientId}`);
50
+
51
+ client.on('issue', (issue) => {
52
+ console.warn(`[Client: ${client.clientId}] Issue: ${issue.type} - ${issue.severity} - ${issue.description}`);
53
+ });
54
+ });
55
+
56
+ call.on('update', () => {
57
+ console.log(
58
+ `[Call: ${call.callId}] Metrics updated. Score: ${call.score?.toFixed(1)}, Clients: ${call.numberOfClients}`
59
+ );
60
+ });
61
+ });
62
+
63
+ // 3. Process Client Samples
64
+ // (ClientSample typically comes from your application after processing getStats() output)
65
+ function processClientStats(rawStats: any, callId: string, clientId: string) {
66
+ // Transform rawStats into the ClientSample format
67
+ // This is a placeholder for your actual transformation logic
68
+ const sample: ClientSample = {
69
+ callId,
70
+ clientId,
71
+ timestamp: Date.now(),
72
+ // ...populate with transformed stats from rawStats, adhering to the ClientSample schema
73
+ // from github.com/observertc/schemas
74
+ };
75
+ observer.accept(sample);
76
+ }
77
+
78
+ // Example usage:
79
+ // const myRawClientStats = getStatsFromClient();
80
+ // processClientStats(myRawClientStats, 'myMeeting123', 'userABC');
81
+
82
+ // 4. Cleanup when done
83
+ // process.on('SIGINT', () => observer.close());
84
+ ```
85
+
2
86
  ---
87
+
88
+ ## Detailed Documentation
89
+
90
+ The following sections provide a comprehensive guide to `observer-js`.
91
+
92
+ ### 1. General Description
93
+
94
+ (This section is identical to the introductory paragraph at the top of this README)
95
+
96
+ ### 2. Core Concepts
97
+
98
+ #### 2.1. Data Flow
99
+
100
+ 1. **Client-Side**: Your application collects WebRTC statistics (e.g., via `RTCPeerConnection.getStats()`).
101
+ 2. **Transformation**: These raw stats are transformed into the `ClientSample` schema (ideally from [observertc/schemas](https://github.com/observertc/schemas)).
102
+ 3. **Ingestion**: The `ClientSample` is passed to the `observer.accept()` method.
103
+ 4. **Processing**: `observer-js` processes the sample, updating or creating relevant entities (`ObservedCall`, `ObservedClient`, `ObservedPeerConnection`, etc.) and their metrics.
104
+ 5. **Analysis**: Metrics are analyzed for issue detection and quality scoring.
105
+ 6. **Events**: Events are emitted for significant state changes, new issues, or updates.
106
+
107
+ #### 2.2. Entity Hierarchy
108
+
109
+ - **`Observer`**: The root object, managing multiple calls and global settings.
110
+ - **`ObservedCall`**: Represents a distinct call session.
111
+ - **`ObservedClient`**: Represents an individual participant within a call.
112
+ - **`ObservedPeerConnection`**: Represents a WebRTC RTCPeerConnection of a client.
113
+ - **`ObservedInboundRtpStream` / `ObservedOutboundRtpStream`**: Tracks individual media streams.
114
+ - **`ObservedDataChannel`**: Tracks data channels.
115
+ - **`ObservedTURN`**: Tracks global TURN server usage metrics across the observer.
116
+
117
+ #### 2.3. Automatic Entity Creation
118
+
119
+ When `observer.accept(sample)` is called:
120
+
121
+ - If an `ObservedCall` for `sample.callId` doesn't exist, it's typically created.
122
+ - If an `ObservedClient` for `sample.clientId` within that call doesn't exist, it's typically created.
123
+ - Peer connections, streams, and data channels are similarly managed based on IDs in the sample.
124
+
125
+ #### 2.4. Metrics Aggregation
126
+
127
+ The library aggregates a wide array of metrics at each level of the hierarchy, including (but not limited to):
128
+
129
+ - RTT, jitter, packet loss
130
+ - Bytes sent/received (audio, video, data)
131
+ - Codec information
132
+ - ICE connection details, TURN usage
133
+ - Stream/track states (muted, enabled)
134
+ - Frame rates, resolutions
135
+ - Bandwidth estimations
136
+
137
+ #### 2.5. Issue Detection
138
+
139
+ A `Detectors` system analyzes metrics to identify common WebRTC issues (e.g., high packet loss, low audio levels, frozen video, connection setup problems). Issues are reported via events.
140
+
141
+ #### 2.6. Quality Scoring
142
+
143
+ `ScoreCalculator` components assess the quality of calls and clients based on metrics and detected issues, typically resulting in a numerical score (e.g., 0.0 to 5.0).
144
+
145
+ #### 2.7. Event-Driven Architecture
146
+
147
+ The library uses Node.js `EventEmitter` to signal various occurrences, allowing applications to react to changes in real-time.
148
+
149
+ ### 3. API Reference
150
+
151
+ #### 3.1. `Observer`
152
+
153
+ Manages all monitored calls and global observer state.
154
+
155
+ **Configuration (`ObserverConfig`)**
156
+
157
+ ```typescript
158
+ export type ObserverConfig<AppData extends Record<string, unknown> = Record<string, unknown>> = {
159
+ updatePolicy?: 'update-on-any-call-updated' | 'update-when-all-call-updated' | 'update-on-interval';
160
+ updateIntervalInMs?: number; // Used if updatePolicy is 'update-on-interval'
161
+ defaultCallUpdatePolicy?: ObservedCallSettings['updatePolicy'];
162
+ defaultCallUpdateIntervalInMs?: number;
163
+ appData?: AppData; // Custom data for this observer instance
164
+ };
165
+ ```
166
+
167
+ **Constructor**
168
+
169
+ ```typescript
170
+ new Observer<AppData>(config?: ObserverConfig<AppData>)
171
+ ```
172
+
173
+ - `config`: Optional. Defaults: `updatePolicy: 'update-when-all-call-updated'`.
174
+
175
+ **Key Properties**
176
+
177
+ - `observedCalls: Map<string, ObservedCall>`: Active calls.
178
+ - `observedTURN: ObservedTURN`: Aggregated TURN metrics.
179
+ - `appData: AppData | undefined`: Custom application data.
180
+ - `closed: boolean`: True if `close()` has been called.
181
+ - Counters: `totalAddedCall`, `totalRemovedCall`, RTT buckets, `totalClientIssues`, `numberOfClientsUsingTurn`, `numberOfClients`, `numberOfPeerConnections`, etc.
182
+
183
+ **Key Methods**
184
+
185
+ - `createObservedCall<T>(settings: ObservedCallSettings<T>): ObservedCall<T>`
186
+ - `getObservedCall<T>(callId: string): ObservedCall<T> | undefined`
187
+ - `accept(sample: ClientSample): void`: A convenience method to feed WebRTC stats. If `sample.callId` and `sample.clientId` are provided, it will route the sample to the appropriate `ObservedCall` and `ObservedClient`, creating them if they don't exist. The core sample processing for an existing client happens within the `ObservedClient`'s own `accept` or update mechanism.
188
+ - `update(): void`: Manually trigger an update cycle (behavior depends on `updatePolicy`).
189
+ - `close(): void`: Cleans up resources for the observer and all its calls.
190
+ - `createEventMonitor<CTX>(ctx?: CTX): ObserverEventMonitor<CTX>`: For contextual event listening.
191
+
192
+ **Events (`ObserverEvents`)**
193
+
194
+ - `'newcall' (call: ObservedCall)`
195
+ - `'call-updated' (call: ObservedCall)`
196
+ - `'client-event' (client: ObservedClient, event: ClientEvent)`
197
+ - `'client-issue' (client: ObservedClient, issue: ClientIssue)`
198
+ - `'client-metadata' (client: ObservedClient, metadata: ClientMetaData)`
199
+ - `'client-extension-stats' (client: ObservedClient, stats: ExtensionStat)`
200
+ - `'update' ()`
201
+ - `'close' ()`
202
+
203
+ #### 3.2. `ObservedCall`
204
+
205
+ Represents a single call session.
206
+
207
+ **Configuration (`ObservedCallSettings`)**
208
+
209
+ ```typescript
210
+ export type ObservedCallSettings<AppData extends Record<string, unknown> = Record<string, unknown>> = {
211
+ callId: string;
212
+ appData?: AppData;
213
+ updatePolicy?: 'update-on-any-client-updated' | 'update-when-all-client-updated' | 'update-on-interval';
214
+ updateIntervalInMs?: number; // Used if updatePolicy is 'update-on-interval'
215
+ remoteTrackResolvePolicy?: 'mediasoup-sfu'; // For specific SFU integration
216
+ };
217
+ ```
218
+
219
+ **Key Properties**
220
+
221
+ - `callId: string`
222
+ - `appData: AppData | undefined`
223
+ - `numberOfClients: number`
224
+ - `score: number | undefined`: Overall call quality score.
225
+ - `observedClients: Map<string, ObservedClient>`
226
+ - Counters: `totalAddedClients`, `totalRemovedClients`, `numberOfIssues`, RTT buckets, total bytes sent/received (audio/video/data), etc.
227
+
228
+ **Key Methods**
229
+
230
+ - `createObservedClient<T>(settings: ObservedClientSettings<T>): ObservedClient<T>`
231
+ - `getObservedClient<T>(clientId: string): ObservedClient<T> | undefined`
232
+ - `update(): void`
233
+ - `close(): void`
234
+ - `createEventMonitor<CTX>(ctx?: CTX): ObservedCallEventMonitor<CTX>`
235
+
236
+ **Events (Emitted via `ObservedCall` instance)**
237
+
238
+ - `'newclient' (client: ObservedClient)`
239
+ - `'empty' ()`: When the last client leaves.
240
+ - `'not-empty' ()`: When the first client joins an empty call.
241
+ - `'update' ()`
242
+ - `'close' ()`
243
+
244
+ #### 3.3. `ObservedClient`
245
+
246
+ Represents a participant in a call.
247
+
248
+ **Configuration (`ObservedClientSettings`)**
249
+
250
+ ```typescript
251
+ export type ObservedClientSettings<AppData extends Record<string, unknown> = Record<string, unknown>> = {
252
+ clientId: string;
253
+ appData?: AppData;
254
+ // Potentially other client-specific settings
255
+ };
256
+ ```
257
+
258
+ **Key Properties**
259
+
260
+ - `clientId: string`
261
+ - `call: ObservedCall`: Reference to the parent call.
262
+ - `appData: AppData | undefined`
263
+ - `score: number | undefined`: Client quality score.
264
+ - `numberOfPeerConnections: number`
265
+ - `usingTURN: boolean`
266
+ - `observedPeerConnections: Map<string, ObservedPeerConnection>`
267
+ - Counters: `numberOfIssues`, RTT buckets, total bytes sent/received, `availableIncomingBitrate`, `availableOutgoingBitrate`, etc.
268
+
269
+ **Key Methods**
270
+
271
+ - `accept(sample: ClientSample): void`: (Or a similar internal update method called by `Observer.accept` or `ObservedCall`) Processes a `ClientSample` specific to this client, updating its metrics, peer connections, streams, etc. This is the primary point where a client's detailed WebRTC statistics are processed.
272
+ - `createObservedPeerConnection<T>(settings: ObservedPeerConnectionSettings<T>): ObservedPeerConnection<T>`
273
+ - `getObservedPeerConnection<T>(peerConnectionId: string): ObservedPeerConnection<T> | undefined`
274
+ - `update(): void`
275
+ - `close(): void`
276
+ - `createEventMonitor<CTX>(ctx?: CTX): ObservedClientEventMonitor<CTX>`
277
+
278
+ **Events (Emitted via `ObservedClient` instance)**
279
+
280
+ - `'joined' ()`
281
+ - `'left' ()`
282
+ - `'update' ()`
283
+ - `'close' ()`
284
+ - `'newpeerconnection' (pc: ObservedPeerConnection)`
285
+ - `'issue' (issue: ClientIssue)` (and other specific issue events)
286
+
287
+ #### 3.4. `ObservedPeerConnection`
288
+
289
+ Represents an `RTCPeerConnection`.
290
+
291
+ - Tracks ICE connection state, data channel stats, stream stats.
292
+ - Holds `ObservedInboundRtpStream`, `ObservedOutboundRtpStream`, and `ObservedDataChannel` instances.
293
+
294
+ #### 3.5. `ObservedInboundRtpStream` / `ObservedOutboundRtpStream`
295
+
296
+ - Track metrics for individual media streams (audio/video) like codec, packets lost/received, jitter, bytes, etc.
297
+
298
+ #### 3.6. `ObservedDataChannel`
299
+
300
+ - Tracks metrics for data channels like state, messages sent/received, bytes.
301
+
302
+ #### 3.7. `ClientSample` (Schema)
303
+
304
+ This is the primary input data structure passed to `observer.accept()`. It's a comprehensive object that should mirror the information obtainable from WebRTC `getStats()` and other client-side states. Key fields include:
305
+
306
+ - `callId`, `clientId`, `timestamp`
307
+ - `peerConnections: RTCPeerConnectionStats[]`
308
+ - `inboundRtpStreams: RTCInboundRtpStreamStats[]`
309
+ - `outboundRtpStreams: RTCOutboundRtpStreamStats[]`
310
+ - `remoteInboundRtpStreams: RTCRemoteInboundRtpStreamStats[]`
311
+ - `remoteOutboundRtpStreams: RTCRemoteOutboundRtpStreamStats[]`
312
+ - `dataChannels: RTCDataChannelStats[]`
313
+ - `iceLocalCandidates: RTCIceCandidateStats[]`, `iceRemoteCandidates: RTCIceCandidateStats[]`, `iceCandidatePairs: RTCIceCandidatePairStats[]`
314
+ - `mediaSources: RTCAudioSourceStats[] / RTCVideoSourceStats[]`
315
+ - `tracks: RTCMediaStreamTrackStats[]`
316
+ - `certificates: RTCCertificateStats[]`
317
+ - `codecs: RTCCodecStats[]`
318
+ - `transports: RTCIceTransportStats[]` (or similar depending on spec version)
319
+ - `browser`, `engine`, `platform`, `os` (client environment metadata)
320
+ - `userMediaErrors`, `iceConnectionStates`, `connectionStates` (client-reported events/states)
321
+ - `extensionStats` (for custom data)
322
+
323
+ _(Refer to the [observertc/schemas](https://github.com/observertc/schemas) repository, particularly the `ClientSample.ts` definition, for the exact and complete structure.)_
324
+
325
+ ### 4. Configuration Possibilities
326
+
327
+ #### 4.1. Update Policies
328
+
329
+ Control how frequently entities re-calculate metrics and emit `update` events.
330
+
331
+ **Observer Level (`ObserverConfig.updatePolicy`)**
332
+
333
+ - `'update-on-any-call-updated'`: Observer updates if any of its calls update.
334
+ - `'update-when-all-call-updated'`: Observer updates after all its calls update. (Default)
335
+ - `'update-on-interval'`: Observer updates at `ObserverConfig.updateIntervalInMs`.
336
+
337
+ **Call Level (`ObservedCallSettings.updatePolicy` or `ObserverConfig.defaultCallUpdatePolicy`)**
338
+
339
+ - `'update-on-any-client-updated'`: Call updates if any of its clients update.
340
+ - `'update-when-all-client-updated'`: Call updates after all its clients update.
341
+ - `'update-on-interval'`: Call updates at its `updateIntervalInMs`.
342
+
343
+ #### 4.2. Intervals
344
+
345
+ - `ObserverConfig.updateIntervalInMs`
346
+ - `ObserverConfig.defaultCallUpdateIntervalInMs`
347
+ - `ObservedCallSettings.updateIntervalInMs`
348
+
349
+ #### 4.3. Application Data (`appData`)
350
+
351
+ Associate custom context with `Observer`, `ObservedCall`, and `ObservedClient` instances using generics.
352
+
353
+ ```typescript
354
+ interface MyCallAppData {
355
+ meetingTitle: string;
356
+ scheduledAt: Date;
357
+ }
358
+ const call = observer.createObservedCall<MyCallAppData>({
359
+ callId: 'call1',
360
+ appData: { meetingTitle: 'Team Sync', scheduledAt: new Date() },
361
+ });
362
+ console.log(call.appData?.meetingTitle);
363
+ ```
364
+
365
+ #### 4.4. `appData` vs. Attachments
366
+
367
+ The `observer-js` library provides two primary ways to associate custom information with its entities: `appData` and `attachments`. Understanding their distinct purposes is key for effective use.
368
+
369
+ **`appData` (Application Data)**
370
+
371
+ - **Purpose**: `appData` is designed to hold structured, typed, and relatively static metadata about an entity (`Observer`, `ObservedCall`, `ObservedClient`). This data is typically set at the time of entity creation and is directly accessible as a property of the entity instance.
372
+ - **Typing**: It is strongly typed using generics (e.g., `Observer<MyObserverAppData>`). This provides type safety and autocompletion in TypeScript environments.
373
+ - **Mutability**: While technically mutable (if the object assigned is mutable), it's generally intended for information that defines or describes the entity and doesn't change frequently during its lifecycle.
374
+ - **Accessibility**: Directly accessible via `entity.appData`.
375
+ - **Use Cases**:
376
+ - Storing application-specific identifiers (e.g., `userId`, `roomId`, `meetingType`).
377
+ - Configuration flags relevant to how your application interprets this entity.
378
+ - Descriptive information (e.g., `clientDeviceType`, `callRegion`).
379
+
380
+ **`attachments` (Arbitrary Attachments)**
381
+
382
+ - **Purpose**: `attachments` (if implemented as a `Map<string, unknown>` or similar mechanism on entities) are meant for associating arbitrary, often dynamic, or less structured data with an entity. This can be useful for temporary state, inter-plugin communication, or data that doesn't fit neatly into a predefined `appData` schema.
383
+ - **Typing**: Typically less strictly typed (e.g., `unknown` or `any` values in a Map). Consumers of attachments need to perform their own type checks or assertions.
384
+ - **Mutability**: Designed to be more dynamic. Attachments can be added, updated, or removed throughout the entity's lifecycle.
385
+ - **Accessibility**: Accessed via methods like `entity.setAttachment(key, value)`, `entity.getAttachment(key)`, `entity.removeAttachment(key)`.
386
+ - **Use Cases**:
387
+ - Storing temporary state calculated by one part of your application to be read by another (e.g., a custom issue detector plugin might attach intermediate findings).
388
+ - Caching results of expensive computations related to the entity.
389
+ - Allowing different modules or plugins to associate their own private data with an observer entity without needing to modify its core `appData` type.
390
+ - Storing large binary data or complex objects that are not part of the core descriptive metadata.
391
+
392
+ **When to Use Which:**
393
+
394
+ - Use **`appData`** for:
395
+ - Core, descriptive metadata that is known at creation time or changes infrequently.
396
+ - Data that benefits from strong typing and is integral to your application's understanding of the entity.
397
+ - Use **`attachments`** for:
398
+ - Dynamic, temporary, or loosely structured data.
399
+ - Data added by different, potentially independent, parts of your system or plugins.
400
+ - Information that doesn't need to be part of the primary, typed `appData` schema.
401
+
402
+ If `attachments` are not yet a formal feature, this section can serve as a design consideration or be adapted if you introduce such a mechanism. If `attachments` are already present, ensure the description matches their actual implementation.
403
+
404
+ #### 4.5. Remote Track Resolution
405
+
406
+ For SFU scenarios, especially with MediaSoup:
407
+ `ObservedCallSettings.remoteTrackResolvePolicy: 'mediasoup-sfu'`
408
+
409
+ ### 5. Examples
410
+
411
+ #### 5.1. Basic Observer Setup & Sample Ingestion
412
+
413
+ ```typescript
414
+ // filepath: /path/to/your/app.ts
415
+ import { Observer, ObserverConfig } from '@observertc/observer-js'; // Adjust path
416
+ import { ClientSample } from '@observertc/schemas'; // Adjust path if using official schemas
417
+
418
+ const observerConfig: ObserverConfig = {
419
+ updatePolicy: 'update-on-interval',
420
+ updateIntervalInMs: 5000,
421
+ defaultCallUpdatePolicy: 'update-on-any-client-updated',
422
+ };
423
+ const observer = new Observer(observerConfig);
424
+
425
+ observer.on('newcall', (call) => {
426
+ console.log(`[Observer] New call: ${call.callId}`);
427
+ call.on('update', () => {
428
+ console.log(`[Call: ${call.callId}] Updated. Clients: ${call.numberOfClients}, Score: ${call.score?.toFixed(1)}`);
429
+ });
430
+ call.on('newclient', (client) => {
431
+ console.log(`[Call: ${call.callId}] New client: ${client.clientId}`);
432
+ client.on('update', () => {
433
+ // console.log(`[Client: ${client.clientId}] Updated. Score: ${client.score?.toFixed(1)}`);
434
+ });
435
+ client.on('issue', (issue) => {
436
+ console.warn(`[Client: ${client.clientId}] Issue: ${issue.type} - ${issue.severity} - ${issue.description}`);
437
+ });
438
+ });
439
+ });
440
+
441
+ // Function to transform your app's WebRTC stats to ClientSample
442
+ function mapStatsToClientSample(appStats: any, callId: string, clientId: string): ClientSample {
443
+ // Detailed mapping logic here based on ClientSample.ts schema
444
+ // from github.com/observertc/schemas
445
+ return {
446
+ callId,
447
+ clientId,
448
+ timestamp: Date.now(),
449
+ // ... map all relevant stats fields ...
450
+ } as ClientSample; // Ensure all required fields are present
451
+ }
452
+
453
+ // Example: Receiving stats and processing
454
+ const rawStatsFromClient = {
455
+ /* ... your client's getStats() output ... */
456
+ };
457
+ const callId = 'meeting-alpha-123';
458
+ const clientId = 'user-xyz-789';
459
+ const sample = mapStatsToClientSample(rawStatsFromClient, callId, clientId);
460
+ observer.accept(sample);
461
+
462
+ // Later, on application shutdown:
463
+ // observer.close();
464
+ ```
465
+
466
+ #### 5.2. Manual Call and Client Creation
467
+
468
+ ```typescript
469
+ // ... observer setup ...
470
+
471
+ const call = observer.createObservedCall({
472
+ callId: 'scheduled-webinar-456',
473
+ updatePolicy: 'update-on-interval',
474
+ updateIntervalInMs: 10000,
475
+ });
476
+
477
+ const client1 = call.createObservedClient({ clientId: 'presenter-01' });
478
+ // Samples for 'presenter-01' in call 'scheduled-webinar-456' will update this client.
479
+ ```
480
+
481
+ #### 5.3. Using Event Monitors for Contextual Logging
482
+
483
+ ```typescript
484
+ const call = observer.getObservedCall('meeting-alpha-123');
485
+ if (call) {
486
+ const callMonitor = call.createEventMonitor({ callId: call.callId, started: new Date() });
487
+ callMonitor.on('client-joined', (client, context) => {
488
+ console.log(`EVENT_MONITOR (${context.callId}): Client ${client.clientId} joined at ${new Date()}`);
489
+ });
490
+ callMonitor.on('issue-detected', (client, issue, context) => {
491
+ console.error(`EVENT_MONITOR (${context.callId}): Issue on ${client.clientId} - ${issue.description}`);
492
+ });
493
+ }
494
+ ```
495
+
496
+ ### 6. Best Practices
497
+
498
+ - **Resource Management**: Always call `observer.close()`, `call.close()`, and `client.close()` when entities are no longer needed to free resources and stop timers.
499
+ - **Error Handling**: Wrap calls to library methods in `try...catch` blocks where appropriate, especially for operations that might throw errors based on state (e.g., creating an entity that already exists if not using `getOrCreate` patterns).
500
+ - **Event Listener Cleanup**: If dynamically adding/removing listeners, ensure they are properly removed (e.g., using `emitter.off()` or `emitter.removeListener()`) to prevent memory leaks, especially for short-lived monitored entities.
501
+ - **`ClientSample` Accuracy**: The quality of monitoring heavily depends on the completeness and correctness of the `ClientSample` data provided. Ensure thorough mapping from `getStats()`.
502
+ - **Update Policies**: Choose update policies carefully based on the desired granularity of updates and performance considerations.
503
+
504
+ ### 7. Troubleshooting
505
+
506
+ - **Memory Leaks**: Ensure `close()` is called on all entities. Check for unremoved event listeners.
507
+ - **No Events / Missing Updates**:
508
+ - Verify `observer.accept()` is being called with correctly formatted `ClientSample` data.
509
+ - Ensure `callId` and `clientId` in samples match expectations.
510
+ - Check if `updatePolicy` and `updateIntervalInMs` are configured as intended.
511
+ - **Debugging**: Utilize `console.log` within event handlers at different levels (Observer, Call, Client) to trace data flow and state changes. Use `appData` to add correlation IDs for easier debugging.
512
+
513
+ ### 8. TypeScript Support
514
+
515
+ The library is written in TypeScript and provides type definitions.
516
+ Use generics with `Observer`, `ObservedCall`, and `ObservedClient` to type your custom `appData`.
517
+
518
+ ```typescript
519
+ interface MyClientAppData {
520
+ userId: string;
521
+ role: 'admin' | 'user';
522
+ }
523
+ const client = call.createObservedClient<MyClientAppData>({
524
+ clientId: 'user1',
525
+ appData: { userId: 'u-123', role: 'admin' },
526
+ });
527
+ // client.appData will be typed as MyClientAppData | undefined
528
+ ```
529
+
530
+ ### 9. Contributing
531
+
532
+ (Placeholder for contribution guidelines - e.g., link to CONTRIBUTING.md, coding standards, pull request process)
533
+
534
+ ### 10. License
535
+
536
+ This project is licensed under the [MIT License](LICENSE).
@@ -14,6 +14,7 @@ export type ObservedCallSettings<AppData extends Record<string, unknown> = Recor
14
14
  remoteTrackResolvePolicy?: 'p2p' | 'mediasoup-sfu';
15
15
  updatePolicy?: 'update-on-any-client-updated' | 'update-when-all-client-updated' | 'update-on-interval';
16
16
  updateIntervalInMs?: number;
17
+ maxIdleIfEmptyMs?: number;
17
18
  };
18
19
  export type ObservedCallEvents = {
19
20
  update: [];
@@ -59,6 +60,19 @@ export declare class ObservedCall<AppData extends Record<string, unknown> = Reco
59
60
  numberOfDataChannels: number;
60
61
  maxNumberOfClients: number;
61
62
  deltaNumberOfIssues: number;
63
+ deltaDataChannelBytesReceived: number;
64
+ deltaDataChannelBytesSent: number;
65
+ deltaDataChannelMessagesReceived: number;
66
+ deltaDataChannelMessagesSent: number;
67
+ deltaInboundPacketsLost: number;
68
+ deltaInboundPacketsReceived: number;
69
+ deltaOutboundPacketsSent: number;
70
+ deltaReceivedAudioBytes: number;
71
+ deltaReceivedVideoBytes: number;
72
+ deltaSentAudioBytes: number;
73
+ deltaSentVideoBytes: number;
74
+ deltaTransportReceivedBytes: number;
75
+ deltaTransportSentBytes: number;
62
76
  deltaRttLt50Measurements: number;
63
77
  deltaRttLt150Measurements: number;
64
78
  deltaRttLt300Measurements: number;
@@ -68,8 +82,9 @@ export declare class ObservedCall<AppData extends Record<string, unknown> = Reco
68
82
  startedAt?: number;
69
83
  endedAt?: number;
70
84
  closedAt?: number;
71
- private _callStartedEvent;
72
- private _callEndedEvent;
85
+ lastClientTimestamp: number;
86
+ maxIdleIfEmptyMs?: number;
87
+ private _autoCloseTimer?;
73
88
  constructor(settings: ObservedCallSettings<AppData>, observer: Observer);
74
89
  get numberOfClients(): number;
75
90
  get score(): number | undefined;
@@ -81,5 +96,6 @@ export declare class ObservedCall<AppData extends Record<string, unknown> = Reco
81
96
  private _onClientUpdate;
82
97
  private _clientJoined;
83
98
  private _clientLeft;
99
+ private _createAutoClose;
84
100
  }
85
101
  //# sourceMappingURL=ObservedCall.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObservedCall.d.ts","sourceRoot":"","sources":["../src/ObservedCall.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,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