Skip to content

Commit

Permalink
Add a TURN server
Browse files Browse the repository at this point in the history
Attempts to fix #282, but as soon as firefox and chromium have the same
editor open, the firefox tab gets extremely slow. This is not useable
yet at the moment.
  • Loading branch information
carlobeltrame committed Sep 28, 2022
1 parent af617d0 commit 3bf9edd
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env.cypress
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ HITOBITO_CALLBACK_URI=https://qualix/login/hitobito/callback
# Collaboration in the feedback editor via WebRTC
COLLABORATION_ENABLED=false
COLLABORATION_SIGNALING_SERVERS="wss://signaling.yjs.dev wss://y-webrtc-signaling-eu.herokuapp.com wss://y-webrtc-signaling-us.herokuapp.com"
COLLABORATION_ICE_SERVERS=

SENTRY_RELEASE=
SENTRY_LARAVEL_DSN=https://[email protected]/12345
Expand Down
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ HITOBITO_CALLBACK_URI=https://localhost/login/hitobito/callback
# Collaboration in the feedback editor via WebRTC
COLLABORATION_ENABLED=true
COLLABORATION_SIGNALING_SERVERS="wss://signaling.yjs.dev wss://y-webrtc-signaling-eu.herokuapp.com wss://y-webrtc-signaling-us.herokuapp.com"
COLLABORATION_ICE_SERVERS=

SENTRY_RELEASE=
SENTRY_LARAVEL_DSN=
Expand Down
1 change: 1 addition & 0 deletions .env.testing
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ HITOBITO_CALLBACK_URI=https://localhost/login/hitobito/callback
# Collaboration in the feedback editor via WebRTC
COLLABORATION_ENABLED=false
COLLABORATION_SIGNALING_SERVERS="wss://signaling.yjs.dev wss://y-webrtc-signaling-eu.herokuapp.com wss://y-webrtc-signaling-us.herokuapp.com"
COLLABORATION_ICE_SERVERS=

SENTRY_RELEASE=
SENTRY_LARAVEL_DSN=https://[email protected]/12345
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ HITOBITO_CALLBACK_URI=https://qualix.flamberg.ch/login/hitobito/callback
# Collaboration in the feedback editor via WebRTC
COLLABORATION_ENABLED=true
COLLABORATION_SIGNALING_SERVERS="wss://signaling.yjs.dev wss://y-webrtc-signaling-eu.herokuapp.com wss://y-webrtc-signaling-us.herokuapp.com"
COLLABORATION_ICE_SERVERS="[{ \"urls\": \"turn:openrelay.metered.ca:80\", \"username\": \"openrelayproject\", \"credentials\": \"openrelayproject\" }]"
SENTRY_LARAVEL_DSN=<snip>
SENTRY_USER_FEEDBACK_URL=<snip>
Expand Down
2 changes: 2 additions & 0 deletions resources/js/components/feedback/FeedbackEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ export default {
const ydoc = new Y.Doc()
const feedbackKey = 'qualix-feedback-' + this.courseId + '-' + this.collaborationKey.substr(0, 8)
const signalingServers = window.Laravel.signalingServers
const iceServers = JSON.parse(window.Laravel.iceServers || null)
const provider = new WebrtcProvider(feedbackKey, ydoc, {
password: this.collaborationKey.substr(8),
...(signalingServers ? { signaling: signalingServers } : {}),
...(iceServers ? { peerOpts: { config: { iceServers } } } : {}),
})
return extensions.concat([
Collaboration.configure({ document: ydoc }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ export default {
const ydoc = new Y.Doc()
const feedbackKey = 'qualix-feedback-' + this.feedback.feedback_data.course_id + '-' + this.feedback.collaborationKey.substr(0, 8)
const signalingServers = window.Laravel.signalingServers
const iceServers = JSON.parse(window.Laravel.iceServers || null)
new WebrtcProvider(feedbackKey, ydoc, {
password: this.feedback.collaborationKey.substr(8),
...(signalingServers ? { signaling: signalingServers } : {}),
...(iceServers ? { peerOpts: { config: { iceServers } } } : {}),
})
return [Collaboration.configure({ document: ydoc })]
},
Expand Down
1 change: 1 addition & 0 deletions resources/views/layouts/master.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'csrf' => csrf_token(),
'nonce' => app('csp-nonce'),
'signalingServers' => explode(' ', env('COLLABORATION_SIGNALING_SERVERS')),
'iceServers' => env('COLLABORATION_ICE_SERVERS'),
'username' => Auth::user() ? Auth::user()->name : null,
]) }}"></div>
<script src="{{ mix('js/app.js') }}"></script>
Expand Down

0 comments on commit 3bf9edd

Please sign in to comment.