Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate mediasoup WebRTC server from JavaScript to TypeScript #29

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
38 changes: 36 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,36 @@
node_modules
certs
# compiled output
/dist
/node_modules
/certs

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"semi": false,
"singleQuote": true
}
21 changes: 0 additions & 21 deletions Dockerfile

This file was deleted.

201 changes: 0 additions & 201 deletions LICENSE

This file was deleted.

17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ MEDIASOUP_INGRESS_HOST='localhost'
}
```

### Create Rooms
### Create Rooms

This endpoint is used to create a new room or use an existing room based on the provided or generated `roomId`. It returns the WebSocket URL and the `roomId` used, and checks for unique room identifiers before proceeding.

Expand All @@ -166,7 +166,7 @@ This endpoint is used to create a new room or use an existing room based on the

#### Parameters (all optional)

- `roomId`: It allows you to send the code for a room that needs to be created. If no code is sent, the endpoint will automatically create one, which will be returned by the method.
- `roomId`: It allows you to send the code for a room that needs to be created. If no code is sent, the endpoint will automatically create one, which will be returned by the method.

- `eventNotificationUri`: Enable the sending of notifications when a peer joins or leaves the room, The responses that the configured endpoint will receive are the following:

Expand All @@ -178,8 +178,7 @@ This endpoint is used to create a new room or use an existing room based on the
}
```

- `maxPeerCount`: Allows set the maximum number of allowed participants into the room

- `maxPeerCount`: Allows set the maximum number of allowed participants into the room

#### Response

Expand All @@ -190,9 +189,10 @@ This endpoint is used to create a new room or use an existing room based on the
{
"protocol": "2060-mediasoup-v1",
"wsUrl": "wss://localhost:443",
"roomId": "12345abcde",
"roomId": "12345abcde"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don’t need to update this file, avoiding unnecessary changes is a good practice. Keep in mind that during a refactor, you may have many important changes, and this can make the review process more difficult.

}
```

**Note:** With the response obtained, the client must add the necessary parameters to complete the connection.. example `wss://localhost:443/?roomId=12345abcde&peerId=4321` or `wss://localhost:443/?roomId=12345abcde`

#### Error
Expand All @@ -206,7 +206,6 @@ This endpoint is used to create a new room or use an existing room based on the
}
```


### Config

Provides the current configuration of the server as defined in the `config.js` file.
Expand Down Expand Up @@ -268,14 +267,10 @@ Retrieve ICE Server settings via a peer websocket request to create a WebRTC Tra
}
```

## Protocol Documentation Webrtc-Server
## Protocol Documentation Webrtc-Server

For detailed information on Mediasoup Server protocol and request methods, check out the [Mediasoup Server Protocol Guide](./docs/mediasoup-server-protocol.md).


## WebRTC Client Setup Documentation

For detailed instructions on setting up a WebRTC client using Mediasoup, including JavaScript and Python examples, check out the [WebRTC Client Setup Guide](./docs/webrtc-client-setup-guide.md).



5 changes: 0 additions & 5 deletions connect.js

This file was deleted.

22 changes: 22 additions & 0 deletions demo/webclient/certs/fullchain.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDnTCCAoWgAwIBAgIUF4Z3Z6DCBcVl15JMrUpr/8zGK2UwDQYJKoZIhvcNAQEL
BQAwXjELMAkGA1UEBhMCQ0gxDTALBgNVBAgMBFZhdWQxETAPBgNVBAcMCExhdXNh
bm5lMQwwCgYDVQQKDANESEMxCzAJBgNVBAsMAklUMRIwEAYDVQQDDAlsb2NhbGhv
c3QwHhcNMjMwODIyMTExNzQ5WhcNMjQwODIxMTExNzQ5WjBeMQswCQYDVQQGEwJD
SDENMAsGA1UECAwEVmF1ZDERMA8GA1UEBwwITGF1c2FubmUxDDAKBgNVBAoMA0RI
QzELMAkGA1UECwwCSVQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcN
AQEBBQADggEPADCCAQoCggEBALOyS9XZXPDZuGFJ/Ah25ceCK1UOoJnkHzyK5R+r
g0MW2lIRR37eFcx7jgNRo6b+HdqxT9WEZROUzumvfFw3dLlwpup8rBcNtcKI9tNT
nkatl5CrBdgngPtbnm6IVxalUR+c7VjtvtNWQL68URF6H95fnLciMoTpLD8b7xXr
w/OuHtA1tkxavQTrfXYW8UVjlaA5s/BCshIsuIIEc6jDx0RtwCK5cx9GeJAfiy60
Id6zq5Aa/qb9cHqUC+K3VNUHMXUx7V4lcG+G3o6lbbjoussvh2ZlWyWE7zN+r1W/
cVWDbEKLBCBgNI+/asxMaMCCWOgqshhBX/8w02O4WoOGMscCAwEAAaNTMFEwHQYD
VR0OBBYEFCpLophcXv2eGwnMmCiTdn95koAvMB8GA1UdIwQYMBaAFCpLophcXv2e
GwnMmCiTdn95koAvMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
AItAnIciWZFmV8SUZyPAHw4R74Fro2KbxwSqCAt4wvUx0MkXJjYTxkVoSugX5XXQ
Ivsp/o0G52Mf0cSn7EFxXZwfNMzJtIld4NvFC66nKQxeVi65JfKwK3gFA/qijpZq
5+ePoi3l/KR4jbbPsuVMs7aYx4NJQbTvdKLk6zOIpZKC7hC9mh88LgeQRjAK+0YM
yREdx1SNKofPHlhthvRpbBnAoSYabft1yUx6Ymf49HNB/avKjU1AFmkGsqjzBm1c
e8kumChkeQttV4aeUYr6UtLxBEptm8YIaYoPgCz1POKcnjaAEpvou/UWTYrhTPVx
BHN1BMYLiB/UZo6TwGYdkYs=
-----END CERTIFICATE-----
Loading