jolly-doctor-73636
10/16/2025, 9:30 AMtall-airline-16756
10/16/2025, 9:30 AMtall-airline-16756
10/16/2025, 9:31 AMjolly-doctor-73636
10/16/2025, 9:33 AMtall-airline-16756
10/16/2025, 9:34 AMsendData method provided by the Kotlin SDK (which works seamlessly with Java). Here's a simple way to get this set up:
// Create RoomServiceClient
RoomServiceClient roomService = RoomServiceClient.createClient(
"your-livekit-url",
"your-api-key",
"your-api-secret"
);
// Prepare JSON message
String jsonMessage = "{\"action\": \"update\", \"value\": 123}";
byte[] dataBytes = jsonMessage.getBytes(StandardCharsets.UTF_8);
// Send to specific agent by identity
List<String> destinationIdentities = Arrays.asList("agent-identity");
// Send the data
Call<Void> call = roomService.sendData(
"room-name",
dataBytes,
LivekitModels.DataPacket.Kind.RELIABLE,
Collections.emptyList(), // destinationSids
destinationIdentities, // destinationIdentities
"custom-topic" // optional topic
);
// Execute the call
call.execute();
Key Details to Keep in Mind:
• Delivery Options: You can choose RELIABLE if you want to make sure the message gets through, or LOSSY if you prefer faster, real-time updates.
• Targeting: Use destinationIdentities to direct your message to specific agents by their identity.
• Authentication: Just make sure your API credentials include roomAdmin permissions to have the right access.
If anything feels unclear or you want to explore this further, please don’t hesitate to reach out—I’m here to help!
Sources: agent-console/app/api/room/send-data/route.ts | src/main/kotlin/io/livekit/server/RoomServiceClient.kt | Data packets | LiveKit Docs | packages/livekit-server-sdk/src/RoomServiceClient.ts | avatars/hedra/education_avatar/agent.pyjolly-doctor-73636
10/16/2025, 9:34 AMtall-airline-16756
10/16/2025, 9:35 AM