Skip to content

Commit

Permalink
Fix mozilla/thimble.mozilla.org#2341 - Implemented logic for unique r…
Browse files Browse the repository at this point in the history
…ooms (#820)

* Added logic for unique rooms

* Moved to window.location, Added comments

* Shifted to URLSearchParams for url parsing

* Shifted to searchParams

* Reverted hosted.js, modified log
  • Loading branch information
hkirat authored and Gideon Thomas committed Aug 31, 2017
1 parent c329542 commit 7676f0c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/editor/Collaboration.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ define(function (require, exports, module) {
// TODO : Shift this to config.
url: "localhost:8888"
});
//To be moved to the bramble API.
var query = (new URL(window.location.href)).searchParams;
this.room = query.get("collaboration") || Math.random().toString(36).substring(7);
console.log(this.room);
this.webrtc = webrtc;
this.pending = []; // pending clients that need to be initialized.
this.changing = false;
};

Collaboration.prototype.init = function(codemirror) {
var self = this;
this.webrtc.joinRoom('thimble', function() {
this.webrtc.joinRoom(this.room, function() {
self.codemirror = codemirror;
self.webrtc.sendToAll("new client", {});
self.webrtc.on("createdPeer", function(peer) {
Expand Down

0 comments on commit 7676f0c

Please sign in to comment.