I am using LiveKit server and the JS client in a r...
# server-api
p
I am using LiveKit server and the JS client in a realtime collaboration web app. This app does not use media streams or tracks, only exchanges data using data channels. I am using reliable delivery mode and data is sent to all participants. My question is: are data packets routed to participants using the same SFU pipeline as media streams? All docs only mention media tracks and media servers when discussing the SFU architecture, so I would like to confirm if this is the case.
r
Yes, data packets in LiveKit are routed through the same SFU pipeline as media streams. Let me trace through the code to show you exactly how this works. Data Packet Routing Flow When you send data using reliable delivery mode, the data follows this path through the SFU: 1. Participant receives data: Data comes into
ParticipantImpl.onReceivedDataMessage()
participant.go:1935-1949 2. Data packet processing: The participant processes the data packet and calls the room's data packet handler participant.go:2046-2049 3. Room broadcasts to all participants: The room uses
BroadcastDataPacketForRoom()
which iterates through all participants and sends the data to each one room.go:1776-1836 4. Transport layer delivery: Each participant receives the data via
SendDataMessage()
which goes through the same transport infrastructure as media transportmanager.go:300-303 https://github.com/livekit/livekit/blob/d0d212fd/pkg/rtc/participant.go https://github.com/livekit/livekit/blob/d0d212fd/pkg/rtc/transportmanager.go https://github.com/livekit/livekit/blob/d0d212fd/pkg/rtc/transport.go