-
Notifications
You must be signed in to change notification settings - Fork 102
Server RoomServiceClient.sendData no longer received by agent after upgrading to @livekit/[email protected] and @livekit/[email protected] #587
Description
Select which package(s) are affected
@livekit/rtc-node
Describe the bug
Summary
After upgrading to @livekit/rtc-node 0.13.22 and @livekit/agents 1.0.31, server-side data messages sent with RoomServiceClient.sendData are no longer received by the agent, even though the code, topic, and room wiring have not changed.
The same code works as expected with @livekit/agents 1.0.22 and @livekit/rtc-node 0.13.20.
Environment
@livekit/rtc-nodeversion:0.13.22@livekit/agentsversion:1.0.31- Previous working versions:
@livekit/rtc-node0.13.20@livekit/agents1.0.22
Current behavior
The backend sends a reliable data packet with a specific topic from the server using RoomServiceClient.sendData, but the agent that is joined to the room no longer receives this message after the upgrade.
Previously working server-side code:
const roomService = new RoomServiceClient(livekitUrl, livekitApiKey, livekitApiSecret);
const textId = randomUUID();
const message = {
action: 'add_text',
text_id: textId,
text: 'Good job!',
};
await roomService.sendData(
args.input.roomName,
new TextEncoder().encode(JSON.stringify(message)),
DataPacket_Kind.RELIABLE,
{ topic: 'server-commands' },
);With the previous versions (@livekit/agents 1.0.22 / @livekit/rtc-node 0.13.20), the agent receives this data message as expected.
With the new versions (@livekit/agents 1.0.31 / @livekit/rtc-node 0.13.22), the agent no longer receives this data packet, even though:
- The code shown above is unchanged
- The
topic('server-commands') is unchanged - The agent code that listens for data messages is unchanged
Expected behavior
RoomServiceClient.sendData should continue to deliver reliable data packets with a topic to all participants in the room, including the agent, as it did in @livekit/agents 1.0.22 / @livekit/rtc-node 0.13.20.
The agent should receive the JSON payload and be able to handle the server-commands topic as before.
Reproduction
- Set up a LiveKit room with an agent using
@livekit/agents1.0.31and@livekit/rtc-node0.13.22 - Ensure the agent is listening for data messages on the topic
'server-commands' - From a Node.js backend, use
RoomServiceClient.sendData()to send a data packet:const roomService = new RoomServiceClient(livekitUrl, livekitApiKey, livekitApiSecret); await roomService.sendData( roomName, new TextEncoder().encode(JSON.stringify({ action: 'add_text', text: 'Test' })), DataPacket_Kind.RELIABLE, { topic: 'server-commands' }, );
- Observe that the agent does NOT receive the data message
- Downgrade to
@livekit/agents1.0.22and@livekit/rtc-node0.13.20 - Repeat steps 3-4
- Observe that with the older versions, the agent DOES receive the data message
Logs
System Info
- OS: Node.js environment (server-side)
- @livekit/rtc-node: 0.13.22 (broken) / 0.13.20 (working)
- @livekit/agents: 1.0.31 (broken) / 1.0.22 (working)
- Node.js: v22.19.0LiveKit server version
LiveKit cloud
Severity
blocking an upgrade
Additional Information
No response