Connection to signaling
This article explains how to connect a client to signaling and join a room via VT API
To connect you need to know the values of the following fields from the user license:signaling_url,username,password - you can get them from the license file with those credentials.
JSON query example:
query
{
"username": "[email protected]", // username from license
"auth": "{\"password\":\"qwerty\"}" // password from license
}C# code example:
public void Connect(string signaling, string room, string username, string password)
{
_room = room;
SocketIO = new SocketIO(signaling.StartsWith("https") ? signaling : $"https://{signaling}");
SocketIO.Options.Query = new Dictionary<string, string>
{
["username"] = username,
["auth"] = $"{{\\"password\\":\\"{password}\\"}}",
};
Console.WriteLine($"--> query: {SocketIO.JsonSerializer.Serialize(new object[] { SocketIO.Options.Query }).Json}");
SocketIO.OnError += (_, e) => OnError(e);
SocketIO.OnConnected += (_, __) => Console.WriteLine("<-- connected");
SocketIO.OnDisconnected += (_, __) => Console.WriteLine("<-- disconnected");
SocketIO.OnAny(EventHandler);
SocketIO.ConnectAsync();
} You will need to handle the following events:
on_connection, you will needauth_idvalue from this event response.on_joinon_leave
JSON on_connectionexample:
on_connection
[
{
"session_id": 1653558286392,
"signaling_ver": "2.1",
"remoteAddress": "::ffff:172.18.0.1",
"remotePort": 38822,
"headers": {...},
"server_metadata": {...},
"username": "[email protected]",
"role": "owner",
"auth_room": "Auth",
"auth_id": "pol2b6VKbaSVbCyyAAIs"
}
]JSON on_join example:
on_join (first value - id of joined member)
[
"EawLi6fQ9jKByY/R46TRSyVHsKY=", // joined member id
{
"hardware_id": "{42CE8DCF-14EC-00DA-9625-91768E3ED46E}",
"location": "US, Chicago",
"mode": "enum",
"name": "_VT_MNG_RCV_",
"peerType": "cpp",
"rcv_name": "VT_ReceiverMng",
"vt_version": "1.9.4.966",
"id": "WbaqzsMXqeQiwuoa",
"private": {...},
"join_props": {...}
}
]Join room
To join the room you will need the room_id which is generated by the signaling after you send the auth_room_name_mask like in the following JSON request.
In response, you will get the callback with the room_id.
C# Code example:
Now when you get room_id value you can join room:
You will receive a callback with members field - a collection of managers in the room you’ve joined.
Optionally you can enumerate the managers with an individual request:
Right now you are prepared to work with managers.
Last updated