defineSchema

Stores the definition of a data track schema, making it available to subscribers.

Define a schema before publishing any data track that references it, so subscribers can resolve it by ID via getSchema. Treat a definition as write-once — whether redefining an existing one is rejected is up to the server.

val schema = DataTrackSchemaId("reading.v1", DataTrackSchemaEncoding.JsonSchema)
room.localParticipant.defineSchema(schema, definition)
room.localParticipant.publishDataTrack(
"reading",
DataTrackPublishOptions(DataTrackFrameEncoding.Json, schema),
)

Return

A successful Result if the schema was stored, or a failure containing DataTrackSchemaException.

Parameters

id

Identifies the schema; the same ID goes into DataTrackPublishOptions.

definition

The definition, stored as-is. It is neither parsed nor validated against its DataTrackSchemaId.encoding, so it's up to the caller to keep it well-formed.