Skip to content

Commit b856b20

Browse files
authored
Update README.md
1 parent 279464f commit b856b20

File tree

1 file changed

+42
-5
lines changed

1 file changed

+42
-5
lines changed

README.md

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,47 @@
11
# PeerRTC Twilio IceServers ☃️
2-
* A simple backend server used by [PeerRTC](https://github.com/PeerRTC/PeerRTC) for retrieving default ice servers provided by [Twilio](https://www.twilio.com/).
2+
A simple backend server used by [PeerRTC](https://github.com/PeerRTC/PeerRTC) for retrieving default ice servers provided by [Twilio](https://www.twilio.com/).
3+
Using this [server](https://github.com/PeerRTC/PeerRTC-Twilio-IceServers) is optional since there are a lot of ways to obtain ice servers.
34

5+
## 💡 Additional Info
46
* If no `configurations` parameter are provided in the [PeerRTC constructor](https://github.com/PeerRTC/PeerRTC#peerrtc-constructor),
5-
then the module will automatically fetch iceServers from the [server](https://github.com/PeerRTC/PeerRTC-Twilio-IceServers) owned by us.
7+
then the module will automatically fetch ice servers from the [server](https://github.com/PeerRTC/PeerRTC-Twilio-IceServers) owned by us.
68

7-
* Using this [server](https://github.com/PeerRTC/PeerRTC-Twilio-IceServers) is optional since there are a lot of ways to obtain ice servers. It is also adviseable to provide own
8-
way of obtaining ice servers since we are only using free account in [Twilio](https://www.twilio.com/).
9+
* It is adviseable to provide own way of obtaining ice servers since we are only using free account in [Twilio](https://www.twilio.com/).
910

10-
* Feel free the [source code]((https://github.com/PeerRTC/PeerRTC-Twilio-IceServers)) as template.
11+
## ⚙️ Setup
12+
1. Create account and log in [Twilio](https://www.twilio.com/).
13+
2. Install [Node.js](https://nodejs.org/en/) first. Skip this step if already installed.
14+
3. Clone this [repository]([https://github.com/PeerRTC/PeerRTC-Server](https://github.com/PeerRTC/PeerRTC-Twilio-IceServers)).
15+
4. In command line, navigate to root directory of the newly downloaded repository.
16+
5. Install all needed dependencies via `npm install` in the command line.
17+
6. Set the enviroment variables. The server needed the TOKEN and SID environment as it will be passed
18+
in the Twilio api. In the command line,
19+
```
20+
set SID=your-account-sid
21+
set TOKEN=your-token
22+
```
23+
Account sid and token can be found in Twilio [console](https://console.twilio.com/) on Account Info section.
24+
25+
7. Start the server by entering `npm start` in the command line.
26+
27+
## 👨‍🏫 Usage
28+
The server is using the getIceServers get method to return an array of ice servers.
29+
```
30+
https://your-server.com/getIceServers
31+
```
32+
The returned array can be inserted in the [PeerRTC constructor](https://github.com/PeerRTC/PeerRTC#peerrtc-constructor) as follows:
33+
```
34+
fetch("https://your-server.com/getIceServers")
35+
.then(response=>response.json())
36+
.then(iceServers=>{
37+
38+
serverURL = "https://my-own-server-url.com"
39+
configurations = {
40+
iceServers: iceServers,
41+
...
42+
}
43+
44+
peer = new PeerRTC(serverURL, configurations)
45+
})
46+
47+
```

0 commit comments

Comments
 (0)