LiveKit ESP32 SDK
Loading...
Searching...
No Matches
Data Packets

Low-level API for high-frequency data exchange. More...

Data Structures

struct  livekit_data_payload_t
 Payload containing a pointer to data and its size. More...
struct  livekit_data_received_t
 Information about a data packet received from a remote participant passed to livekit_room_options_t::on_data_received. More...
struct  livekit_data_publish_options_t
 Options passed to livekit_room_publish_data. More...

Functions

livekit_err_t livekit_room_publish_data (livekit_room_handle_t handle, livekit_data_publish_options_t *options)
 Publishes a data packet to participants in a room asynchronously.

Detailed Description

Low-level API for high-frequency data exchange.

For more information about this feature, see the LiveKit documentation.


Data Structure Documentation

◆ livekit_data_payload_t

struct livekit_data_payload_t

Payload containing a pointer to data and its size.

Data Fields
uint8_t * bytes Pointer to data.
size_t size Size of the data.

◆ livekit_data_received_t

struct livekit_data_received_t

Information about a data packet received from a remote participant passed to livekit_room_options_t::on_data_received.

Data Fields
livekit_data_payload_t payload Received data.
char * sender_identity Identity of the participant who sent the data.
char * topic Topic the data was sent under if specified by the sender.

◆ livekit_data_publish_options_t

struct livekit_data_publish_options_t

Options passed to livekit_room_publish_data.

Data Fields
char ** destination_identities Identifies of participants to send the data packet to.

If not specified, the data packet is sent to all participants.

int destination_identities_count Number of destination identities.
bool lossy Whether the data packet is sent using the lossy channel.
livekit_data_payload_t * payload Data to publish and its size.
char * topic Topic to send the data packet under.

Function Documentation

◆ livekit_room_publish_data()

livekit_err_t livekit_room_publish_data ( livekit_room_handle_t handle,
livekit_data_publish_options_t * options )

Publishes a data packet to participants in a room asynchronously.

Parameters
handle[in]Room handle.
options[in]Data to send with options (e.g. reliability, topic, etc.).
Returns
LIVEKIT_ERR_NONE if successful, otherwise an error code.

Example usage:

const char* command = "G5 I0 J3 P0 Q-3 X2 Y3";
livekit_payload_t payload = {
.bytes = (uint8_t*)command,
.size = strlen(command)
};
.payload = &payload,
.topic = "gcode",
.lossy = false,
.destination_identities = (char*[]){ "printer-1" },
.destination_identities_count = 1
};
livekit_room_publish_data(room_handle, &options);
livekit_err_t livekit_room_publish_data(livekit_room_handle_t handle, livekit_data_publish_options_t *options)
Publishes a data packet to participants in a room asynchronously.
Options passed to livekit_room_publish_data.
Definition livekit.h:345