Loading...
const offer = await pc.createOffer();
ws.send(JSON.stringify({ type: 'offer', sdp: offer }));await pc.setLocalDescription();
ws.send(JSON.stringify({ type: 'offer', sdp: pc.localDescription }));
pc.onicecandidate = ({ candidate }) => {
if (candidate) ws.send(JSON.stringify({ type: 'candidate', candidate }));
};The offer is applied locally before sending, and ICE candidates are forwarded as they are found.
Yes. Any channel that delivers messages works, including HTTP requests, though WebSocket is common because both sides can send at any time.
Sending ICE candidates through signaling as soon as they are found, instead of waiting for all of them, which makes calls connect faster.
Only for renegotiation, such as adding a track or restarting ICE. Media itself does not pass through it.