Skip to content

Commit

Permalink
Send leave_room events when leaving rooms
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaicoianu committed Oct 17, 2016
1 parent 970f811 commit 3fa5f3c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/external/JanusClientConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,4 +409,12 @@ JanusClientConnection.prototype.enter_room = function(url) {
}
});
};
JanusClientConnection.prototype.leave_room = function(url) {
this.send({
'method': 'leave_room',
'data': {
'roomId': md5(url)
}
});
};

7 changes: 7 additions & 0 deletions scripts/janusweb.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ setTimeout(function() {
//setTimeout(elation.bind(this.currentroom, this.currentroom.die), 1000);
//this.currentroom.die();
this.currentroom.disable();
this.leave_room(this.currentroom.url);
this.currentroom = false;
}
this.refresh();
Expand Down Expand Up @@ -359,6 +360,11 @@ setTimeout(function() {
this.network.enter_room(url);
}
}
this.leave_room = function(url) {
if (this.network) {
this.network.leave_room(url);
}
}
this.onJanusMessage = function(msg) {
var method = msg.data.method
if (method == 'user_moved') {
Expand Down Expand Up @@ -455,6 +461,7 @@ setTimeout(function() {

if (remote.room !== room) {
room.add(remote);
remote.room = room;
}

if (movedata.dir) {
Expand Down

0 comments on commit 3fa5f3c

Please sign in to comment.