Sfoglia il codice sorgente

Add client and pro heartbeat pings

Vijayakrishnan 5 anni fa
parent
commit
e31a4c401e

+ 23 - 0
resources/views/client-dashboard.blade.php

@@ -76,6 +76,8 @@
                 selfUserType: 'CLIENT',
                 selfStreamId: '',
                 noOneElseInCall: true,
+
+                heartbeatTimer: false,
             },
             methods: {
                 timeDisplay: function() {
@@ -220,6 +222,12 @@
                         // turn client video off
                         $.post('/api/clientVideoVisit/turnClientVideoOff', {}, function(_data) {
                             console.log(_data);
+
+                            // stop heart beat
+                            if(self.heartbeatTimer) {
+                                window.clearInterval(self.heartbeatTimer);
+                                self.heartbeatTimer = false;
+                            }
                         });
 
                         // in case of accidental disconnection
@@ -253,6 +261,14 @@
                         // turn client video on
                         $.post('/api/clientVideoVisit/turnClientVideoOn', {}, function(_data) {
                             console.log(_data);
+
+                            // start heart beat
+                            self.heartbeatTimer = window.setInterval(function() {
+                                $.post('/api/clientVideoVisit/registerClientVideoHeartbeat', {}, function(_data) {
+                                    console.log(_data);
+                                });
+                            }, 5000);
+
                         });
                     });
 
@@ -273,6 +289,13 @@
                         // turn client video off
                         $.post('/api/clientVideoVisit/turnClientVideoOff', {}, function(_data) {
                             console.log(_data);
+
+                            // stop heart beat
+                            if(self.heartbeatTimer) {
+                                window.clearInterval(self.heartbeatTimer);
+                                self.heartbeatTimer = false;
+                            }
+
                         });
                     });
 

+ 22 - 1
resources/views/pro-call.blade.php

@@ -67,7 +67,9 @@
                 selfStreamId: '',
                 patientInQueue: false,
 
-                videoActive: false
+                videoActive: false,
+
+                heartbeatTimer: false,
             },
             methods: {
                 pollForNextPatient: function() {
@@ -287,6 +289,12 @@
                         // turn pro video off
                         $.post('/api/clientVideoVisit/turnProVideoOff', {}, function(_data) {
                             console.log(_data);
+
+                            // stop heart beat
+                            if(self.heartbeatTimer) {
+                                window.clearInterval(self.heartbeatTimer);
+                                self.heartbeatTimer = false;
+                            }
                         });
                     });
 
@@ -318,6 +326,13 @@
                         // turn pro video on
                         $.post('/api/clientVideoVisit/turnProVideoOn', {}, function(_data) {
                             console.log(_data);
+
+                            // start heart beat
+                            self.heartbeatTimer = window.setInterval(function() {
+                                $.post('/api/clientVideoVisit/registerProMeetingHeartbeat', {}, function(_data) {
+                                    console.log(_data);
+                                });
+                            }, 5000);
                         });
                     });
 
@@ -341,6 +356,12 @@
                         // turn pro video off
                         $.post('/api/clientVideoVisit/turnProVideoOff', {}, function(_data) {
                             console.log(_data);
+
+                            // stop heart beat
+                            if(self.heartbeatTimer) {
+                                window.clearInterval(self.heartbeatTimer);
+                                self.heartbeatTimer = false;
+                            }
                         });
                     });