Skip to content

Commit

Permalink
Add TURN support
Browse files Browse the repository at this point in the history
The TURN server url can be set via environment variable VUE_APP_TURN_URL.
  • Loading branch information
farao committed Jun 20, 2020
1 parent b46acda commit 69e62d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ Sets the location to the palava signaling server. By default, it tries to reach

The (required) [STUN server](https://en.wikipedia.org/wiki/STUN) to use, defaults to `stun: stun:stun.palava.tv`

### `VUE_APP_STUN_URL`

The (optional) [TURN server](https://en.wikipedia.org/wiki/TURN) to use.

### `BUILD_NOT_MINIFIED`

When set, the production build will not be minified.
Expand Down
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export default {
env: {
rtcUrl: process.env.VUE_APP_RTC_URL,
stunUrl: process.env.VUE_APP_STUN_URL,
turnUrl: process.env.VUE_APP_TURN_URL,
},
defaultRtcUrl: 'ws://localhost:4233',
defaultStunUrl: 'stun:stun.palava.tv',
Expand Down
7 changes: 4 additions & 3 deletions src/views/Room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ export default {
const roomId = this.$route.params.roomId
this.catchInvalidRoomId(roomId)
this.rtc = this.setupRtc(
new Session({
roomId,
sessionConfig = {
webSocketAddress: config.env.rtcUrl || config.defaultRtcUrl,
stun: config.env.stunUrl || config.defaultStunUrl,
joinTimeout: config.defaultJoinTimeout,
})
}
if (config.env.turnUrl) { sessionConfig["turn"] = config.env.turnUrl }
new Session(roomId, sessionConfig)
)
},
beforeDestroy() {
Expand Down

0 comments on commit 69e62d4

Please sign in to comment.