Trickle ICE for WHIP - API
This API lets you exchange ICE candidates incrementally for a WHIP session. Trickle ICE allows the WebRTC connection to be established more efficiently by sending ICE candidates as they are discovered, rather than waiting for all candidates to be gathered.
HTTP method and endpoint
PATCH
|
https://api.videosdk.live/v2/whip/sessions/${sessionId}Headers Parameters
REQUIRED
values : YOUR_TOKEN_WITHOUT_ANY_PREFIX
This will be a JWT token generate using VideoSDK ApiKey and Secret.
Note that the token will not include any prefix such as "Basic " or "Bearer ". Just pass a token as value.
You can generate a new token by refering this Guide: Generate Auth token
REQUIRED
values : application/json
This is usefull for json body parameters, so that VideoSDK servers can understand that the incoming body parameter will be a JSON string.
Query Parameters
REQUIRED
The participant ID associated with the WHIP session.
Parameters
REQUIRED
The unique identifier of the WHIP session.
Body Parameters
REQUIRED
ICE candidate fragments in SDP format (
application/trickle-ice-sdpfrag). This contains incremental ICE candidate information discovered during the WebRTC connection establishment process. Multiple PATCH requests may be sent as candidates are discovered. PATCH
|
https://api.videosdk.live/v2/whip/sessions/${sessionId}
NodeJS
import fetch from 'node-fetch';
const options = {
method: "PATCH",
headers: {
"Authorization": "$YOUR_TOKEN",
"Content-Type": "application/trickle-ice-sdpfrag",
},
body: sdpOffer, // SDP offer or ICE candidate fragments
};
const sessionId = "your_sessionId";
const url= `https://api.videosdk.live/v2/whip/sessions/${sessionId}?participantId=whip-broadcaster`;
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
RESPONSE
""
Got a Question? Ask us on discord