mirror of
https://github.com/livekit/livekit.git
synced 2026-04-03 14:55:40 +00:00
1.2 KiB
1.2 KiB
Signaling Protocol
LiveKit uses a websocket connection for signaling. Each client should start the RTC session by connecting to /rtc.
Joining a room
Handling negotiations
Negotiation is how WebRTC makes changes to the current communication, including adding/removing tracks. In WebRTC, either side could initiate the change and it makes synchronization a challenge.
In LiveKit, we've added a layer of synchronization so that negotiations are more deterministic. The server becomes the place to control who should be issuing offers in a negotiation cycle. When the client wants to issue an offer to the server after the initial connection is made, this is the flow
- client's onnegotiationneeded callback is triggered
- client sends server a
NegotiationRequest - server determines when it's ready for a new offer, and notifies client with
NegotiationResponse - when client receives
NegotiationResponse, it generates a new offer and sends it as anofferin the form ofSessionDescription. - server accepts the offer and sends an
answer - client calls
setRemoteDescriptionwith that session description.
now the negotiation is complete and track changes have been applied.