Title here
Summary here
The ObserveRTC Schema package provides a strongly typed, versioned schema system for collected monitoring data. It ensures interoperability and consistency between all ObserveRTC components while supporting forward compatibility for evolving metrics and requirements.
npm install @observertc/schemasimport {
ClientSample,
SfuSample,
ObserverEventReport
} from '@observertc/schemas';
// Type-safe sample creation
const clientSample: ClientSample = {
timestamp: Date.now(),
clientId: 'client-123',
type: 'outbound-rtp',
data: {
ssrc: 12345,
bytesSent: 1024,
packetsSent: 100
}
};
// Validate sample structure
import { validateClientSample } from '@observertc/schemas/validators';
const isValid = validateClientSample(clientSample);
if (!isValid) {
console.error('Invalid client sample structure');
}import { schemas, validators } from '@observertc/schemas';
// Access schema definitions
const clientSampleSchema = schemas.ClientSample;
// Validate data against schema
const sample = {
timestamp: Date.now(),
clientId: 'client-123'
// ... sample data
};
if (validators.validateClientSample(sample)) {
console.log('Sample is valid');
} else {
console.error('Sample validation failed');
}Explore the detailed documentation for different aspects of the Schema package:
Learn about generating type-safe language bindings, managing schema versions, and the development workflow.
Complete reference for ClientSample schema structure, field definitions, and all available statistics types.