fresh-park-25815
11/01/2025, 9:06 AMtall-airline-16756
11/01/2025, 9:06 AMtall-airline-16756
11/01/2025, 9:08 AM/rtc endpoint. Don’t forget to include authentication using a Bearer token in the Authorization header—that’s key!
2. Join Request: Once connected, send a JoinRequest message. The server will then reply with a JoinResponse that includes important room and participant details.
3. Media Negotiation: Next up, exchange SDP offers and answers with SessionDescription messages, and share ICE candidates through TrickleRequest messages. This helps set up the media streams smoothly.
4. Connection Management: To keep things running nicely, use messages like `Ping`/`Pong` for health checks and LeaveRequest when you want to disconnect gracefully.
By making sure your bot follows these steps, you’ll help maintain a stable and reliable connection. If you’d like, I’m here to dive deeper into any part of this flow—just let me know!
Sources: livekit/livekit_rtc.pb.go | Protocol & WebRTC Stack | livekit/livekit_composite | DeepWiki | livekit-android-sdk/src/main/java/io/livekit/android/room/SignalClient.kt | test/client/client.go | test/core/signal_client_test.dartfresh-park-25815
11/01/2025, 9:15 AMtall-airline-16756
11/01/2025, 9:15 AMTrackPublication object.
• Subscribing: Participants can subscribe to tracks to receive and render media. If autoSubscribe is turned on, new tracks will be automatically delivered to participants.
Also, there’s an option to enable detailed statistics reporting for media metrics, but this isn’t required to confirm activity. Please feel free to reach out if you’d like me to explain any part of this in more detail or if you have other questions—I’m here to help!
Sources: Rooms, participants, and tracks | LiveKit docs | Realtime media | LiveKit Docs | Subscribing to tracks | LiveKit docs | pkg/sfu/downtrack.go | Sources/LiveKit/Track/Metrics/MetricsManager.swiftfresh-park-25815
11/01/2025, 9:18 AMtall-airline-16756
11/01/2025, 9:19 AMfresh-park-25815
11/01/2025, 9:23 AMtall-airline-16756
11/01/2025, 9:24 AMautoSubscribe flag is on (which it is by default), the bot will automatically subscribe to all existing tracks as soon as it joins the room, and it will also subscribe to any new tracks published by participants who join later on.
• Manual Subscribe Request: If autoSubscribe is enabled, there’s no need to send manual subscribe requests after joining. But if you decide to disable autoSubscribe, you’ll want to manually subscribe to the tracks you’re interested in using selective subscription methods.
Please feel free to reach out if you’d like me to explain anything further or if you need a hand with the implementation. I’m here to help!
Sources: pkg/rtc/room.go | livekit-api/src/signal_client/mod.rs | Rooms, participants, and tracks | LiveKit docs | src/options.ts | Subscribing to tracks | LiveKit docsfresh-park-25815
11/01/2025, 9:25 AMtall-airline-16756
11/01/2025, 9:25 AMPingInterval). Also, keep an eye out for Pong responses, and if you don’t receive one within the PingTimeout, you’ll want to close the connection to keep things running smoothly.
• AutoSubscribe: If you set autoSubscribe to true during the join request, the server will automatically subscribe your bot to all current and future tracks—so no need to send manual subscribe requests unless you’ve turned autoSubscribe off.
• Track Management: Keep track of signaling messages for any new track publications (like TrackPublished) and handle them accordingly. If autoSubscribe is disabled, you’ll want to send UpdateSubscription requests to subscribe to specific tracks.
Please feel free to reach out if you’d like me to walk you through any part of this flow in more detail—I’m here to help!fresh-park-25815
11/01/2025, 11:28 AMtall-airline-16756
11/01/2025, 11:28 AMautoSubscribe is set to true, your bot will be automatically subscribed to all existing and future tracks without you needing to send a manual Subscribe request. The server will still send TrackSubscribed and SubscriptionResponse messages as part of the signaling protocol to confirm these subscriptions and keep publishers informed.
If you have any questions or need a hand with handling these messages in your implementation, please don’t hesitate to reach out. I’m here to help!
Sources: Rooms, participants, and tracks | LiveKit docs | Subscribing to tracks | LiveKit docs | Sources/LiveKit/Protos/livekit_rtc.pb.swift | livekit/src/room/mod.rsfresh-park-25815
11/01/2025, 11:30 AMtall-airline-16756
11/01/2025, 11:31 AMTrickleRequest in LiveKit. This usually happens in a few key moments:
• During Initial Peer Connection Setup: You’ll want to send each ICE candidate as it’s gathered (for example, through onicecandidate callbacks) for both the publisher and subscriber connections.
• After Reconnection: If the bot reconnects to the room, be sure to send any new ICE candidates to help re-establish the connections smoothly.
• Final Candidate Indicator: Don’t forget to send a TrickleRequest with final: true to let the system know that candidate gathering is complete.
Also, make sure the target field in your request clearly specifies whether the candidate is for the PUBLISHER or SUBSCRIBER connection. If you’d like, I’m here to help with any more details or guidance on how to implement this—just let me know!
Sources: livekit-api/src/signal_client/mod.rs | pkg/rtc/signalling/signalhandler.go | livekit/livekit_rtc.pb.gofresh-park-25815
11/01/2025, 11:34 AMtall-airline-16756
11/01/2025, 11:35 AMtarget: PUBLISHER in the TrickleRequest.
• Subscriber: This connection is used when your bot is receiving media from other participants. ICE candidates for this connection should be sent with target: SUBSCRIBER in the TrickleRequest.
Each connection type needs its own set of ICE candidates to set up the media path properly. If you'd like, I’m here to help with more details or examples on how to handle these connections—just let me know!fresh-park-25815
11/01/2025, 11:35 AMtall-airline-16756
11/01/2025, 11:36 AMRTCPeerConnection specifically for publishing.
2. Generate an SDP offer using createOffer and send it to the server as a SessionDescription message with target: PUBLISHER.
3. As ICE candidates come in (through the onicecandidate event), send each candidate to the server in a TrickleRequest with target: PUBLISHER.
4. Once all candidates are gathered, send a final TrickleRequest with final: true to let the server know candidate gathering is complete.
Subscriber Connection
This is used when your bot is receiving media from other participants. The steps are:
1. Receive an SDP offer from the server for the subscriber connection.
2. Create a WebRTC RTCPeerConnection for subscribing and set the received SDP offer as the remote description.
3. Generate an SDP answer using createAnswer and send it to the server as a SessionDescription message with target: SUBSCRIBER.
4. As ICE candidates are discovered (via the onicecandidate event), send each candidate to the server in a TrickleRequest with target: SUBSCRIBER.
5. When all candidates are gathered, send a TrickleRequest with final: true to signal the end of candidate gathering.
Example TrickleRequest
{
"candidate": "candidate:842163049 1 udp 1677729535 192.168.1.2 3478 typ srflx raddr 0.0.0.0 rport 0 generation 0",
"sdpMid": "0",
"sdpMLineIndex": 0,
"target": "PUBLISHER"
}
If anything isn’t clear or you’d like me to provide more examples, please don’t hesitate to ask. I’m here to help!fresh-park-25815
11/01/2025, 11:39 AMtall-airline-16756
11/01/2025, 11:40 AMTrickleRequest with the final field set to true. This is a perfectly supported way to indicate that the candidate gathering process has finished.
To keep track of when all candidates are gathered, just watch the iceGatheringState of your RTCPeerConnection. Once it changes to complete, it means all candidates are ready, and you can confidently send them all in one request.
If you’d like, I’m here to help you with any part of this implementation—just let me know!
Sources: livekit/livekit_rtc.pb.go | livekit-protocol/src/livekit.rs | lib/src/proto/livekit_rtc.pb.dart | Documentation/BasicUsage.mdfresh-park-25815
11/01/2025, 11:41 AMtall-airline-16756
11/01/2025, 11:42 AMJoinResponse automatically right after connecting to the /rtc WebSocket endpoint. The client actually needs to send a JoinRequest first to start joining the room. Once the server gets that request, it will then send back a JoinResponse with the room and participant details.
If you’re seeing a JoinResponse without having sent a JoinRequest, it could mean there’s something off with the way things are set up on your end or with the server. Please feel free to reach out if you’d like some help figuring this out—I’m here to support you!
Sources: livekit/livekit_rtc.pb.go | Protocol & WebRTC Stack | livekit/livekit_composite | DeepWiki | livekit-android-sdk/src/main/java/io/livekit/android/room/SignalClient.kt | pkg/rtc/participant_signal.gofresh-park-25815
11/01/2025, 11:54 AMtall-airline-16756
11/01/2025, 11:54 AMJoinResponse right after the WebSocket connection. Instead, the JoinResponse is always sent in reply to a JoinRequest from the client.
If you’re seeing a JoinResponse without having sent a JoinRequest, it might mean there’s something happening with how your WebSocket client (like sipsorcery) is managing the connection or perhaps sending messages unintentionally. It could be helpful to take a closer look at the WebSocket traffic to see if any messages are being sent automatically when the connection is established.
Please feel free to reach out if you’d like support with troubleshooting this further—I’m here to help!
Sources: Web and mobile frontends | LiveKit Docs | src/room/RTCEngine.ts | examples/agent-dispatch/index.tsfresh-park-25815
11/01/2025, 12:10 PMtall-airline-16756
11/01/2025, 12:11 PMJoinResponse or any signaling-related actions since they aren’t part of the signaling layer.
If sipsorcery doesn’t support LiveKit’s signaling protocol and only manages RTP/RTCP, it’s pretty unlikely that RTP/RTCP messages are causing the server to send a JoinResponse. The server really needs a WebSocket JoinRequest to start the signaling flow.
To help get to the bottom of this, I’d suggest taking a look at the WebSocket traffic to see if any unexpected messages are being sent when connecting. This can often reveal what’s triggering the unexpected JoinResponse. Please feel free to share what you find or ask any other questions—I’m here to help!fresh-park-25815
11/01/2025, 9:35 PM/rtc
2. server sends a JoinResponse, which includes room information, the current participant's data, and information about other participants in the room
3. server initiates the subscriber PeerConnection, sends offer to client
◦ if AutoSubscribe is enabled, this offer will contain existing tracks in the room.
◦ the offer will include two data channels as part of the connection
4. client and server will exchange ICE candidates via trickle
5. client accepts the subscriber connection, sends an answer
6. ICE connectivity is established
7. server notifies other participants of the new participant
after rtc - i get JoinResponse.tall-airline-16756
11/01/2025, 9:35 PM/rtc, the server automatically sends a JoinResponse right at the beginning. This response shares important details like room information, participant data, and info about others in the room.
So, there’s no need to send a JoinRequest manually here, since the server takes care of that as soon as the WebSocket connection is made. If you have any questions or want to walk through the next steps in the signaling flow, please feel free to ask—I’m here to help!