X-Git-Url: https://git.r.bdr.sh/rbdr/junction/blobdiff_plain/44d7c8891d37679c33689b5d4a24c783b8d7fc84..90b43ea817f95364b429c4b55a565634b3d59638:/extension/junction.js diff --git a/extension/junction.js b/extension/junction.js index 2dbff78..f1a4361 100644 --- a/extension/junction.js +++ b/extension/junction.js @@ -40,22 +40,29 @@ const internals = { this.socket = io(socketUrl); + var that = this; + this.socket.on('connect', function() { console.log("Connected to signaling server"); + + that.socket.emit('join', { + 'url': currentUrl, + }); }); this.socket.on('disconnect', function() { console.log("disconnected from signaling server"); }); - this.socket.on('addPeer', function() { - this.peers++; - console.log(`There are now ${this.peers} participants`); + this.socket.on('addPeer', function(data) { + console.log(data); + that.peers++; + console.log(`There are now ${that.peers} participants`); }); this.socket.on('removePeer', function() { - this.peers--; - console.log(`There are now ${this.peers} participants`); + that.peers--; + console.log(`There are now ${that.peers} participants`); }); console.log(activeTabs[0].url); // placeholder while we connect backend.