powerful-magician-63563
12/31/2025, 2:42 PMtall-airline-16756
12/31/2025, 2:42 PMtall-airline-16756
12/31/2025, 2:42 PMpowerful-magician-63563
12/31/2025, 2:44 PMtall-airline-16756
12/31/2025, 2:44 PMawait context.room.local_participant.publish_data(
json.dumps({
"method": "create_feedback_card",
"params": {"message": corrected_text}
}),
kind=rtc.DataPacketKind.RELIABLE
)
1. iOS frontend — register a handler for that RPC/data and update UI on the main thread:
room.localParticipant?.registerRPCHandler { [weak self] invocation in
guard invocation.method == "create_feedback_card",
let params = invocation.params as? [String:Any],
let message = params["message"] as? String else { return }
DispatchQueue.main.async {
self?.createFeedbackCard(message: message)
}
}
Notes:
• Use DataPacketKind.RELIABLE for guaranteed delivery of the feedback card payload.
• Ensure the agent has permission to publish data and the iOS participant is connected and listening.
• If you want lower latency and can tolerate drops, UNRELIABLE is an option, but RELIABLE is recommended for UI updates.
If you want, I can:
• Share a complete minimal Python agent tool snippet that includes error handling, or
• Show how to parse additional fields (e.g., confidence, timestamps) in the iOS handler. Which would you prefer? Sources: Tool definition and use | LiveKit docs