Send an SDP offer
Sends the client’s SDP offer for a registered connection. The answer is produced
asynchronously: poll GET on this path until it returns 200.
track_mapping names the track behind each SDP mid, so the model can match media to its
declared tracks without parsing the SDP.
Only the user who started the session may call this. A session token works only for the sessions bound to it.
curl --request POST \
--url https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sdp_offer": "v=0\r\no=- 4611731400430051336 2 IN IP4 127.0.0.1\r\n...",
"client_info": {
"sdk_version": "3.4.0",
"sdk_type": "js"
},
"track_mapping": [
{
"mid": "0",
"name": "main_video",
"kind": "video",
"direction": "recvonly"
},
{
"mid": "1",
"name": "webcam",
"kind": "video",
"direction": "sendonly"
}
]
}
'import requests
url = "https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params"
payload = {
"sdp_offer": "v=0
o=- 4611731400430051336 2 IN IP4 127.0.0.1
...",
"client_info": {
"sdk_version": "3.4.0",
"sdk_type": "js"
},
"track_mapping": [
{
"mid": "0",
"name": "main_video",
"kind": "video",
"direction": "recvonly"
},
{
"mid": "1",
"name": "webcam",
"kind": "video",
"direction": "sendonly"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sdp_offer: 'v=0\r\no=- 4611731400430051336 2 IN IP4 127.0.0.1\r\n...',
client_info: {sdk_version: '3.4.0', sdk_type: 'js'},
track_mapping: [
{mid: '0', name: 'main_video', kind: 'video', direction: 'recvonly'},
{mid: '1', name: 'webcam', kind: 'video', direction: 'sendonly'}
]
})
};
fetch('https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sdp_offer' => 'v=0
o=- 4611731400430051336 2 IN IP4 127.0.0.1
...',
'client_info' => [
'sdk_version' => '3.4.0',
'sdk_type' => 'js'
],
'track_mapping' => [
[
'mid' => '0',
'name' => 'main_video',
'kind' => 'video',
'direction' => 'recvonly'
],
[
'mid' => '1',
'name' => 'webcam',
'kind' => 'video',
'direction' => 'sendonly'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params"
payload := strings.NewReader("{\n \"sdp_offer\": \"v=0\\r\\no=- 4611731400430051336 2 IN IP4 127.0.0.1\\r\\n...\",\n \"client_info\": {\n \"sdk_version\": \"3.4.0\",\n \"sdk_type\": \"js\"\n },\n \"track_mapping\": [\n {\n \"mid\": \"0\",\n \"name\": \"main_video\",\n \"kind\": \"video\",\n \"direction\": \"recvonly\"\n },\n {\n \"mid\": \"1\",\n \"name\": \"webcam\",\n \"kind\": \"video\",\n \"direction\": \"sendonly\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sdp_offer\": \"v=0\\r\\no=- 4611731400430051336 2 IN IP4 127.0.0.1\\r\\n...\",\n \"client_info\": {\n \"sdk_version\": \"3.4.0\",\n \"sdk_type\": \"js\"\n },\n \"track_mapping\": [\n {\n \"mid\": \"0\",\n \"name\": \"main_video\",\n \"kind\": \"video\",\n \"direction\": \"recvonly\"\n },\n {\n \"mid\": \"1\",\n \"name\": \"webcam\",\n \"kind\": \"video\",\n \"direction\": \"sendonly\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sdp_offer\": \"v=0\\r\\no=- 4611731400430051336 2 IN IP4 127.0.0.1\\r\\n...\",\n \"client_info\": {\n \"sdk_version\": \"3.4.0\",\n \"sdk_type\": \"js\"\n },\n \"track_mapping\": [\n {\n \"mid\": \"0\",\n \"name\": \"main_video\",\n \"kind\": \"video\",\n \"direction\": \"recvonly\"\n },\n {\n \"mid\": \"1\",\n \"name\": \"webcam\",\n \"kind\": \"video\",\n \"direction\": \"sendonly\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}Authorizations
A Reactor API key (rk_...), sent as Authorization: Bearer rk_.... Keep it on a server.
Headers
The API protocol version the client speaks. Currently 1. Older versions than the server's minimum get 426.
"1"
The WebRTC signaling protocol version, as major.minor.
"1.0"
Path Parameters
The session's ID, as returned by POST /sessions.
The connection's ID, as returned when it was registered.
1001 <= x <= 99994321
Body
Response
The offer was accepted. Poll for the answer.
curl --request POST \
--url https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sdp_offer": "v=0\r\no=- 4611731400430051336 2 IN IP4 127.0.0.1\r\n...",
"client_info": {
"sdk_version": "3.4.0",
"sdk_type": "js"
},
"track_mapping": [
{
"mid": "0",
"name": "main_video",
"kind": "video",
"direction": "recvonly"
},
{
"mid": "1",
"name": "webcam",
"kind": "video",
"direction": "sendonly"
}
]
}
'import requests
url = "https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params"
payload = {
"sdp_offer": "v=0
o=- 4611731400430051336 2 IN IP4 127.0.0.1
...",
"client_info": {
"sdk_version": "3.4.0",
"sdk_type": "js"
},
"track_mapping": [
{
"mid": "0",
"name": "main_video",
"kind": "video",
"direction": "recvonly"
},
{
"mid": "1",
"name": "webcam",
"kind": "video",
"direction": "sendonly"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sdp_offer: 'v=0\r\no=- 4611731400430051336 2 IN IP4 127.0.0.1\r\n...',
client_info: {sdk_version: '3.4.0', sdk_type: 'js'},
track_mapping: [
{mid: '0', name: 'main_video', kind: 'video', direction: 'recvonly'},
{mid: '1', name: 'webcam', kind: 'video', direction: 'sendonly'}
]
})
};
fetch('https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sdp_offer' => 'v=0
o=- 4611731400430051336 2 IN IP4 127.0.0.1
...',
'client_info' => [
'sdk_version' => '3.4.0',
'sdk_type' => 'js'
],
'track_mapping' => [
[
'mid' => '0',
'name' => 'main_video',
'kind' => 'video',
'direction' => 'recvonly'
],
[
'mid' => '1',
'name' => 'webcam',
'kind' => 'video',
'direction' => 'sendonly'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params"
payload := strings.NewReader("{\n \"sdp_offer\": \"v=0\\r\\no=- 4611731400430051336 2 IN IP4 127.0.0.1\\r\\n...\",\n \"client_info\": {\n \"sdk_version\": \"3.4.0\",\n \"sdk_type\": \"js\"\n },\n \"track_mapping\": [\n {\n \"mid\": \"0\",\n \"name\": \"main_video\",\n \"kind\": \"video\",\n \"direction\": \"recvonly\"\n },\n {\n \"mid\": \"1\",\n \"name\": \"webcam\",\n \"kind\": \"video\",\n \"direction\": \"sendonly\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sdp_offer\": \"v=0\\r\\no=- 4611731400430051336 2 IN IP4 127.0.0.1\\r\\n...\",\n \"client_info\": {\n \"sdk_version\": \"3.4.0\",\n \"sdk_type\": \"js\"\n },\n \"track_mapping\": [\n {\n \"mid\": \"0\",\n \"name\": \"main_video\",\n \"kind\": \"video\",\n \"direction\": \"recvonly\"\n },\n {\n \"mid\": \"1\",\n \"name\": \"webcam\",\n \"kind\": \"video\",\n \"direction\": \"sendonly\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections/{connection_id}/sdp_params")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sdp_offer\": \"v=0\\r\\no=- 4611731400430051336 2 IN IP4 127.0.0.1\\r\\n...\",\n \"client_info\": {\n \"sdk_version\": \"3.4.0\",\n \"sdk_type\": \"js\"\n },\n \"track_mapping\": [\n {\n \"mid\": \"0\",\n \"name\": \"main_video\",\n \"kind\": \"video\",\n \"direction\": \"recvonly\"\n },\n {\n \"mid\": \"1\",\n \"name\": \"webcam\",\n \"kind\": \"video\",\n \"direction\": \"sendonly\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}