telemersive-bus 0.6.8 → 0.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/BusManager.js CHANGED
@@ -12,7 +12,7 @@ const {RoomAccess, RoomInfo, PeerCredentials, PeerInfo} = require('./protos/BusM
12
12
 
13
13
  /* time the housekeeping thread waits until it continues with the next step
14
14
  */
15
- const houseKeepingTimeOut = 500;
15
+ const houseKeepingTimeOut = 1500;
16
16
  const houseKeepingTimeOut_onRepeat = 1500;
17
17
  const houseKeepingTimeOut_onPeerLeft= 1000;
18
18
  const houseKeepingTimeOut_onPeerJoined = 5000;
@@ -164,7 +164,7 @@ class BusManager {
164
164
 
165
165
  for (const key of keys) {
166
166
  // send ping message
167
- console.log(` -> room '${key}' with id '${this.rooms[key].roomId}'...`);
167
+ console.log(` -> room '${key}' with id '${this.rooms[key].roomId}' pings joined peers ...`);
168
168
  await this.communicator.publish(new BusMsgPub(this.busTopics.baseRoomAlive(key).build(), RoomInfo, 1, false).encode(
169
169
  {
170
170
  "timestamp": Math.round(new Date().getTime() / 1000),
@@ -240,7 +240,6 @@ class BusManager {
240
240
  */
241
241
  cleanOut = async () => {
242
242
  if(this.houseKeepingInProgress) {
243
- this.houseKeepingInProgress = false;
244
243
  console.log(` -> housekeeping -> cleaning out ...`);
245
244
  const cleanupAndLeave = async (currentPeer) => {
246
245
  console.log(` <- remove peer '${currentPeer.peerName}' from room '${currentPeer.roomName}' `);
@@ -278,6 +277,9 @@ class BusManager {
278
277
  await this.communicator.unsubscribe(this.busTopics.baseRoomAlivePing("+").build());
279
278
  // cleanup the communicator
280
279
  this.communicator.clearAutoGeneratedSubscriptions();
280
+ // set this flag to false at the end to make sure a new houskeeping cycle can only be started once
281
+ // all topics are unsubscribed - otherwise it won't gather the joined peers inside the room.
282
+ this.houseKeepingInProgress = false;
281
283
  }
282
284
 
283
285
  /**
@@ -547,7 +549,7 @@ class BusManager {
547
549
 
548
550
  delete this.rooms[_roomName];
549
551
  } catch (e) {
550
- console.log(" <! exception while removing room '${_roomName}': ${e.message}");
552
+ console.log(` <! exception while removing room '${_roomName}': '${e.message}' `);
551
553
  }
552
554
  }
553
555
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telemersive-bus",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "description": "MQTT based data protocol to manage unlimited peers, connected by rooms, where all peers joined to a room can exchange private data. It provides a simple chat mechanism, latency pinging, publish-subscribe mechanism (based on mqtt) and a OSC-like data stream. ",
5
5
  "main": "index.js",
6
6
  "directories": {