niklabh / mattermost-plugin-webrtc-video

A webrtc video call plugin for mattermost
Apache License 2.0
84 stars 17 forks source link

Signalhub config sometimes ignored #38

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hi

Sometimes users get the DEFAULT_SIGNAL_HUB_URL instead of the URL from the config. This leads to connection problems.

ghost commented 3 years ago

Folloing patch should fix this:

diff --git a/webapp/src/components/modals/audio_group_call/audio_group_call.jsx b/webapp/src/components/modals/audio_group_call/audio_group_call.jsx
index 6b438c2..1c54513 100644
--- a/webapp/src/components/modals/audio_group_call/audio_group_call.jsx
+++ b/webapp/src/components/modals/audio_group_call/audio_group_call.jsx
@@ -106,6 +106,7 @@ class AudioCallPanel extends React.Component {
             turnServer,
             turnServerUsername,
             turnServerCredential,
+            configLoaded,
             config,
         } = this.state;
         const roomCode = `mattermost-webrtc-video-${config.DiagnosticId}`;
@@ -161,6 +162,10 @@ class AudioCallPanel extends React.Component {
             });
         }

+        if (!configLoaded) {
+            return;
+        }
+
         const hub = signalhub(roomCode, [signalhubURL || 'https://baatcheet.herokuapp.com']);

         hub.subscribe('all').on('data', this.handleHubData.bind(this));

I'll test it and make a pr