Skip to content

Remote chat messages missing attributes and attachedFiles when using useChat() #1252

@Gibson-Joseph

Description

@Gibson-Joseph

Description

When sending a chat message using useChat() with an attachment, the sender (local) receives a message object that contains:

  • attachedFiles
  • attributes (if provided)

However, the receiver (remote) does not receive these fields at all.
They are completely missing, not even present as undefined.

Remote message object does not contain attachedFiles or attributes keys.

Steps to Reproduce

Start two clients connected to the same LiveKit room.

In one client (sender), call:

import { useChat } from '@livekit/components-react';

const { chatMessages, isSending, send } = useChat();

const handleSendMessage = async () => {
  try {
    setMessageText('');
    await send(messageText, { attachments: [file] });
  } catch {}
}

Log chatMessages from useChat() on both clients.

Expected Behavior

Both the sender and receiver should receive identical message structure, including:

{
  message: "...",
  attachedFiles: [...],
  attributes: {...},
  ...
}

Actual Behavior

Sender (local) message object includes both fields:

{
  message: "hello",
  attachedFiles: [File],
  attributes: { foo: "bar" },
  ...
}

Receiver (remote) message object does not include either field:

{
  message: "hello",
  // attachedFiles → missing
  // attributes → missing
  ...
}

Both fields are entirely absent from the remote message object.

Code Snippet

import { useChat } from '@livekit/components-react';

const { chatMessages, send } = useChat();

await send(messageText, {
  attachments: [file] ,
  attributes: { foo: 'bar' }
});

Logging messages:

console.log(chatMessages);

Remote logs show no attachedFiles or attributes properties at all.

Describe the proposed solution

Include attachedFiles and attributes in the chat message so remote users receive the same structure.

Alternatives considered

No response

Importance

I cannot use LiveKit without it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions