repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 7c8098c88c058d2f1f68932378b62b386e546e54:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 7c8098c88c058d2f1f68932378b62b386e546e54
Author: James Baicoianu 
Date:   Sun Nov 8 14:59:02 2020 -0800

    Unsubscribe from rooms when leaving them

diff --git a/scripts/multiplayermanager.js b/scripts/multiplayermanager.js
index 44dc8245f07050c9bc4bb1e0079d967992912a1c..
index ..24343ec192d0587b6c5c228e8129ebd6c1f45518 100644
--- a/scripts/multiplayermanager.js
+++ b/scripts/multiplayermanager.js
@@ -154,7 +154,8 @@ console.log('[MultiplayerManager] set active room:', room, this.activeroom);
       // If we're already in a room, let's leave that one first
       if (this.activeroom) {
         var oldserver = this.getServerForRoom(this.activeroom);
-        oldserver.leave_room(room.url);
+        //oldserver.leave_room(room.url);
+        oldserver.unsubscribe(room.url);
       }

       // Tell the server we're now in the new room
@@ -162,6 +163,7 @@ console.log('[MultiplayerManager] set active room:', room, this.activeroom);
       if (!room.private) {
         var server = this.getServerForRoom(room);
         var partymode = this.player.party_mode && room.party_mode;
+        server.subscribe(room.url);
         server.enter_room(room.url, partymode);
       }
     }
@@ -299,6 +301,7 @@ console.log('[MultiplayerManager] join', room.url);
       var server = this.getServerForRoom(room);
       var partymode = this.player.party_mode && room.party_mode;
       if (server) {
+        server.subscribe(room.url);
         server.enter_room(room.url, partymode);
       }
     }
@@ -308,7 +311,7 @@ console.log('[MultiplayerManager] join', room.url);
 console.log('[MultiplayerManager] part', room.url);
       var server = this.getServerForRoom(room);
       if (server) {
-        server.leave_room(room.url);
+        server.unsubscribe(room.url);
       }
     }
     this.spawnRemotePlayer = function(data) {

-----END OF PAGE-----