# Overview

This guide describes the API for both solutions: TrueConf VideoSDK and TrueConf Room

# Product comparison

The table below describes the features of each solution:

Features TrueConf Room TrueConf VideoSDK
Free PRO Free PRO
Web interface for managing app settings V V V V
Meeting management via web interface V V
Different access rights for administrators and users V V
Selection of UI widgets to be displayed on the main screen V V
Custom background for the main screen V V
Branding: your corporate logo on the main screen V V
No “Free” caption in self-view video and in conferences V V
Availability of API V V V V
NDI protocol: send video via NDI V V
NDI protocol: receive video via NDI V V
TrueConf Room Service V V
Supported operating systems Microsoft Windows 7 SP1 or above
Debian 10 / 11
Ubuntu 20.04 / 21.10
Astra Linux CE 2.12
Astra Linux SE 1.6 / 1.7
Raspberry Pi OS

# Introduction

The control interface represents a single WebSocket used for exchanging messages in the JSON format

# Example

The example below represents an HTML page where a user can click on the Call button to start a call to a contact by TrueConf ID specified in the text input field.

Important. Before opening the page in the browser, make sure that:

  1. VideoSDK/Room has already been started locally.

  2. Unsecured authorization is used to control VideoSDK/Room .

<html lang="en">
<script>
    let ws;
    let inputPeerId;
    let submitButton;
    let resultH4;

    window.addEventListener('load', () => {
        inputPeerId = window.document.getElementById('peerIdInput');
        submitButton = window.document.getElementById('submitButton');
        resultH4 = window.document.getElementById('resultH4');

        submitButton.addEventListener('click', ()=> {
            const peerId = inputPeerId.value;
            sendMsg({ method : "call", peerId });
        });

        init();
    })

    function init(){
        ws = new WebSocket("ws://localhost:8765/");
        ws.addEventListener('message', onMsg);
        ws.addEventListener('error', onError);
        ws.addEventListener('open', onOpen);
    }

    function sendMsg(msg) {
        ws.send(JSON.stringify(msg));
    }

    function onMsg(e) {
        const data = JSON.parse(e.data);

        // Processing: Commands responses
        switch (data.method) {
            case "auth": {
                data.result ? console.log('authorization done') : console.error('authorization error', data.error);

                sendMsg({
                    method: 'login',
                    login: "1@someserver.name",
                    password: "123"
                });
            } 
            break;
        }

        // Processing: Events
        switch (data.event) {
            case "conferenceCreated": {
                resultH4.innerHTML = "confID: " + data.confId;
            }
            break;
        }
    }

    function onError(e) {
        console.error(e);
    }

    function onOpen(e) {
        sendMsg({
            method: 'setUsedApiVersion',
            requestId: "",
            version: "1"
        });

        sendMsg({
            method: 'auth',
            type : "unsecured"
        });
    }
</script>
<body>

<h3>Calling from TrueConf Room to any user by ID</h3>
<input id="peerIdInput" type="text" name="peerId" />
<input id="submitButton" type="submit" value="call" />
<h4 id="resultH4"></h4>

</body>
</html>