LINXD-2209: Added comments

This commit is contained in:
Sergiu Toma 2022-09-13 22:24:10 +03:00
parent 6acd276324
commit b85ba68c9c

32
app.js
View File

@ -15,9 +15,26 @@ import path from 'path'
const __dirname = path.resolve()
import Server from 'socket.io'
import mediasoup, { getSupportedRtpCapabilities } from 'mediasoup'
import mediasoup from 'mediasoup'
let worker
/**
* videoCalls
* |-> Router
* |-> Producer
* |-> Consumer
* |-> Producer Transport
* |-> Consumer Transport
*
* '<callId>': {
* router: Router,
* producer: Producer,
* producerTransport: Producer Transport,
* consumer: Consumer,
* consumerTransport: Consumer Transport
* }
*
**/
let videoCalls = {}
app.get('/', (_req, res) => {
@ -39,19 +56,8 @@ httpsServer.listen(process.env.PORT, () => {
})
const io = new Server(httpsServer)
// socket.io namespace (could represent a room?)
const peers = io.of('/mediasoup')
/**
* Worker
* |-> Router(s)
* |-> Producer Transport(s)
* |-> Producer
* |-> Consumer Transport(s)
* |-> Consumer
**/
const createWorker = async () => {
worker = await mediasoup.createWorker({
rtcMinPort: 2000,
@ -269,8 +275,6 @@ const createWebRtcTransportLayer = async (callId, callback) => {
dtlsParameters: transport.dtlsParameters,
}
// console.log('params', params);
// send back to the client the following prameters
callback({
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#TransportOptions