]> git.r.bdr.sh - rbdr/junction/blobdiff - extension/content_script.js
Add media and peer objects
[rbdr/junction] / extension / content_script.js
index 741e1c4a88df1b03e1ca4c348d910adc866b193e..84a2fd3bce3ed6bd3cd1a306e860fa9f5eed43df 100644 (file)
@@ -4,7 +4,7 @@
 
   const internals = {
 
 
   const internals = {
 
-    kSocketUrl: 'http://unlimited.pizza:8000/',
+    kSocketUrl: 'https://junction.unlimited.pizza/',
 
     port: null,
     socket: null,
 
     port: null,
     socket: null,
       try {
         const mediaStream = await navigator.mediaDevices.getUserMedia({ audio: true });
 
       try {
         const mediaStream = await navigator.mediaDevices.getUserMedia({ audio: true });
 
-        internals.socket = io(internals.kSocketUrl);
+        internals.socket = io(internals.kSocketUrl, {
+          transports: ['websocket']
+        });
+
+        internals.socket.on('error', function(error) {
+
+          console.error('GENERAL ERROR', error);
+        });
+
+        internals.socket.on('connect_error', function(error) {
+
+          console.error('CONNNECT ERROR', error);
+        });
 
 
-        console.log('Connecting to server');
         internals.socket.on('connect', function() {
 
         internals.socket.on('connect', function() {
 
-          console.log("Connected to signaling server");
+          console.log("Connected to signaling server, group: ", data.currentUrl);
           internals.socket.emit('join', {
           internals.socket.emit('join', {
-            'url': currentUrl,
+            'url': data.currentUrl,
           });
         });
 
           });
         });
 
@@ -48,7 +59,6 @@
           console.log(`There are now ${internals.peers} participants`);
         });
 
           console.log(`There are now ${internals.peers} participants`);
         });
 
-        console.log('Done!');
         internals.createAudioElement(data.tada);
       }
       catch (err) {
         internals.createAudioElement(data.tada);
       }
       catch (err) {