Register a WebRTC connection
Registers a WebRTC connection on the session and returns its connection_id. Use that ID
for the offer, the answer, and ICE candidates. A session can hold several connections at
once, up to the connections_per_session quota.
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 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"client_info": {
"sdk_version": "3.4.0",
"sdk_type": "js"
}
}
'import requests
url = "https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections"
payload = { "client_info": {
"sdk_version": "3.4.0",
"sdk_type": "js"
} }
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({client_info: {sdk_version: '3.4.0', sdk_type: 'js'}})
};
fetch('https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections', 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",
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([
'client_info' => [
'sdk_version' => '3.4.0',
'sdk_type' => 'js'
]
]),
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"
payload := strings.NewReader("{\n \"client_info\": {\n \"sdk_version\": \"3.4.0\",\n \"sdk_type\": \"js\"\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"client_info\": {\n \"sdk_version\": \"3.4.0\",\n \"sdk_type\": \"js\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections")
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 \"client_info\": {\n \"sdk_version\": \"3.4.0\",\n \"sdk_type\": \"js\"\n }\n}"
response = http.request(request)
puts response.read_body{
"connection_id": 4321
}{
"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": "quota_exceeded",
"message": "quota exceeded: connections_per_session (limit=4, current=4)",
"quota_type": "connections_per_session",
"limit": 4,
"current": 4
}{
"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.
Body
The SDK the client uses. Optional, and recorded for diagnostics.
Show child attributes
Show child attributes
Response
The connection was registered.
The server-assigned connection ID, from 1002 to 4999.
4321
curl --request POST \
--url https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"client_info": {
"sdk_version": "3.4.0",
"sdk_type": "js"
}
}
'import requests
url = "https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections"
payload = { "client_info": {
"sdk_version": "3.4.0",
"sdk_type": "js"
} }
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({client_info: {sdk_version: '3.4.0', sdk_type: 'js'}})
};
fetch('https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections', 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",
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([
'client_info' => [
'sdk_version' => '3.4.0',
'sdk_type' => 'js'
]
]),
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"
payload := strings.NewReader("{\n \"client_info\": {\n \"sdk_version\": \"3.4.0\",\n \"sdk_type\": \"js\"\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"client_info\": {\n \"sdk_version\": \"3.4.0\",\n \"sdk_type\": \"js\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reactor.inc/sessions/{session_id}/transport/webrtc/connections")
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 \"client_info\": {\n \"sdk_version\": \"3.4.0\",\n \"sdk_type\": \"js\"\n }\n}"
response = http.request(request)
puts response.read_body{
"connection_id": 4321
}{
"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": "quota_exceeded",
"message": "quota exceeded: connections_per_session (limit=4, current=4)",
"quota_type": "connections_per_session",
"limit": 4,
"current": 4
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}{
"error": "<string>",
"message": "<string>",
"resource": "<string>",
"reason": "<string>"
}