clean-mouse-53726
10/17/2025, 12:36 PMpublishData from the Local Participant to send an initial message to the frontend right when the agent starts. Locally everything works, and it also works on our DEV domain, but on our PROD domain (different domain) this specific publishData is completely ignored — the client never receives it and there are no errors. Other publishData messages in our project work fine; only this very first, “startup” message fails on PROD.
Same code and SDK versions across environments. Tokens and grants look correct (canPublishData etc.), topic names match, payload is small, and media (audio/video) works on PROD. We also tried toggling reliability and adding a short delay before sending — sometimes helps, but not consistently. It feels like a timing/race issue where the agent publishes before clients are ready on PROD, but not on DEV.
What could be the cause of publishData being ignored only for this initial message on PROD? Does LiveKit deliver publishData only to participants already connected at that moment (i.e., no buffering for late joiners)? Any recommended pattern to guarantee the initial payload reaches clients on startup (e.g., wait for participants to join, republish on participant join, or target specific identities)? Any diagnostics we can enable to confirm the message leaves the agent and reaches the server?tall-airline-16756
10/17/2025, 12:36 PMtall-airline-16756
10/17/2025, 12:37 PMpublishData calls and checking your server logs to see that messages are being sent and received properly. If you’d like, I’m here to help with any details on setting these up—just let me know!
Sources: Data packets | LiveKit Docs | Sending text | LiveKit Docs | web/providers/GameProvider.tsxclean-mouse-53726
10/17/2025, 12:39 PMtall-airline-16756
10/17/2025, 12:41 PMpublishData, here’s a helpful approach you can try:
1. Check Existing Participants: Take a look at the room.remoteParticipants array to see if anyone is already connected.
2. Listen for New Participants: You can subscribe to the participant_connected event to know when new participants join the room.
3. Publish Once Ready: When you’re sure participants are connected, go ahead and send your publishData message.
Here’s a simple example in JavaScript that might help:
// Check existing participants
if (room.remoteParticipants.size > 0) {
sendInitialMessage();
} else {
// Listen for new participants
room.on('participant_connected', (participant) => {
sendInitialMessage();
});
}
If you’d like, I’m here to help you tailor this to your specific SDK or environment—just let me know!
Sources: livekit-android-sdk/src/main/java/io/livekit/android/room/RTCEngine.kt | cmd/lk/room.go | Tests/LiveKitCoreTests/PublishDataTests.swift | examples/rpc.py | examples/demo/demo.ts