dry-pillow-93451
02/13/2025, 11:51 PMgray-monkey-83525
02/13/2025, 11:51 PMpublishData
method. This method allows you to send data packets with a specified topic, which can include text data up to ~15KB in size.
For example, on the server side, you can publish a message like this:
await localParticipant.publishData(new TextEncoder().encode("your message"), {
reliable: true,
topic: 'text-stream'
});
On the client side, you can listen for these data packets and handle them accordingly:
room.on(RoomEvent.DataReceived, (payload, participant, kind) => {
const message = new TextDecoder().decode(payload);
console.log('Received message:', message);
});
Would you like more details on implementing this?
Sources:
- LiveKit Docs - Data Messages 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.