-
Notifications
You must be signed in to change notification settings - Fork 107
Description
Describe the bug
Just after connecting to a room with LiveKit.connect(...), I immediately receive a data message via onDataReceived.
In response to this message, I send a reply using room.localParticipant.publishData(...).
Sometimes, the message is never sent, and I get the following exception:
RoomException$ConnectException: could not establish publisher connection
This seems to be a race condition: although the room is connected and I receive data, the publisher's PeerConnection is not yet fully established.
To Reproduce
Steps to reproduce the behavior:
- Call LiveKit.connect(...).
- Receive a data message immediately after joining (via onDataReceived).
- In the same flow, send a reply with publishData(...).
- Observe that the message is sometimes: never received by remote participants
Expected behavior
Messages sent with publishData(...) should be reliably sent once the room is connected.
Receiving a message should indicate that connections are ready, or at least not give a false sense of readiness.
Ideally, the SDK should:
buffer the message until the publisher is connected, or expose a clear lifecycle signal that the publisher is ready to send.
Screenshots
If applicable, add screenshots to help explain your problem.
Device Info:
- Device: Google Pixel 7, Samsung A52
- OS: Android 15
- LiveKit SDK version: 2.18.2
Additional context
livekit-logs.txt