Flutter SDK chat messages incompatible with web useChat protocol
SDK versions affected
livekit_client (Flutter): latest
@livekit/components-react (Web): latest
Problem
The @livekit/components-react web SDK has a built-in useChat hook that sends and receives chat messages over the lk-chat data channel topic using a specific JSON protocol:
{ "id": "<uuid>", "message": "hello", "timestamp": 1234567890 }
The Flutter SDK has no equivalent built-in chat implementation. When Flutter clients need to send chat messages, they must publish raw data manually — either as plain text or custom JSON — on the same lk-chat topic. This creates two incompatibilities:
1. Flutter → Web: participant name lost
When a Flutter client publishes a message on lk-chat, the web useChat hook either ignores it (if it doesn't match the expected schema) or renders it without the correct sender name. The web DataReceived handler receives the participant object, but since the message bypasses useChat internals, name resolution has to be done manually via room.remoteParticipants — which is fragile and breaks in edge cases (e.g. when the sender is the local participant).
2. Web dual-send echo causes ghost messages
As a workaround, web clients intercept publishData on the lk-chat topic and send two copies — the original JSON (for useChat) and a plain-text copy (for Flutter). The plain-text copy arrives back at other web participants' DataReceived handlers, where it bypasses useChat and gets injected into the chat DOM via manual DOM manipulation, appearing with no sender name or as 'Mobile User'.
Root cause
There is no standardised cross-platform chat protocol across LiveKit SDKs. The lk-chat topic and its JSON schema exist only in @livekit/components-react and are undocumented as a cross-SDK contract. Flutter has no useChat equivalent, so cross-platform chat requires fragile workarounds.
Expected behaviour
Either:
- The Flutter SDK provides a built-in chat API (
useChat equivalent) that publishes messages in the same { id, message, timestamp } format on the lk-chat topic, OR
- The
lk-chat protocol is formally documented as a cross-SDK standard so third-party implementations (Flutter, Unity, etc.) can be compatible by default
Workaround currently in use
We are intercepting publishData on the web side to dual-send messages, and using MutationObserver + manual DOM injection to render Flutter messages inside the LiveKit chat UI. This is brittle and breaks whenever the LiveKit chat DOM structure changes.
Questions
- Is there a recommended approach for cross-platform chat between Flutter and web clients in the same room?
- Are there plans to add a built-in chat API to the Flutter SDK?
- Should
lk-chat be treated as a stable cross-SDK protocol contract?
Environment
- Flutter client: Android + iOS
- Web client: Next.js +
@livekit/components-react
- Both clients in the same LiveKit room
- LiveKit Cloud
Flutter SDK chat messages incompatible with web
useChatprotocolSDK versions affected
livekit_client(Flutter): latest@livekit/components-react(Web): latestProblem
The
@livekit/components-reactweb SDK has a built-inuseChathook that sends and receives chat messages over thelk-chatdata channel topic using a specific JSON protocol:{ "id": "<uuid>", "message": "hello", "timestamp": 1234567890 }The Flutter SDK has no equivalent built-in chat implementation. When Flutter clients need to send chat messages, they must publish raw data manually — either as plain text or custom JSON — on the same
lk-chattopic. This creates two incompatibilities:1. Flutter → Web: participant name lost
When a Flutter client publishes a message on
lk-chat, the webuseChathook either ignores it (if it doesn't match the expected schema) or renders it without the correct sender name. The webDataReceivedhandler receives theparticipantobject, but since the message bypassesuseChatinternals, name resolution has to be done manually viaroom.remoteParticipants— which is fragile and breaks in edge cases (e.g. when the sender is the local participant).2. Web dual-send echo causes ghost messages
As a workaround, web clients intercept
publishDataon thelk-chattopic and send two copies — the original JSON (foruseChat) and a plain-text copy (for Flutter). The plain-text copy arrives back at other web participants'DataReceivedhandlers, where it bypassesuseChatand gets injected into the chat DOM via manual DOM manipulation, appearing with no sender name or as'Mobile User'.Root cause
There is no standardised cross-platform chat protocol across LiveKit SDKs. The
lk-chattopic and its JSON schema exist only in@livekit/components-reactand are undocumented as a cross-SDK contract. Flutter has nouseChatequivalent, so cross-platform chat requires fragile workarounds.Expected behaviour
Either:
useChatequivalent) that publishes messages in the same{ id, message, timestamp }format on thelk-chattopic, ORlk-chatprotocol is formally documented as a cross-SDK standard so third-party implementations (Flutter, Unity, etc.) can be compatible by defaultWorkaround currently in use
We are intercepting
publishDataon the web side to dual-send messages, and usingMutationObserver+ manual DOM injection to render Flutter messages inside the LiveKit chat UI. This is brittle and breaks whenever the LiveKit chat DOM structure changes.Questions
lk-chatbe treated as a stable cross-SDK protocol contract?Environment
@livekit/components-react