telemersive-bus 0.6.5 → 0.6.7
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 +14 -11
- package/lib/connect/MQTTBus.js +3 -1
- package/package.json +1 -1
package/lib/BusManager.js
CHANGED
|
@@ -286,17 +286,20 @@ class BusManager {
|
|
|
286
286
|
onPeerLeaving = async (_topic, _message, _packet) => {
|
|
287
287
|
console.log(` <- peer '${_message.peerName}' leaving`);
|
|
288
288
|
let shaPassword = sha1(_message.roomPwd).substr(0, 10)
|
|
289
|
-
if
|
|
290
|
-
//
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
289
|
+
if(this.rooms[_message.roomName] !== undefined){
|
|
290
|
+
// make sure the leaving peer leaves a still existing room
|
|
291
|
+
if (this.rooms[_message.roomName].roomPwd === shaPassword){
|
|
292
|
+
// the actual message of this peer leaving the room is generated by the
|
|
293
|
+
// housekeeping routine 'cleanOut':
|
|
294
|
+
// we wait a moment to start with housekeeping, though.
|
|
295
|
+
// it could be, that this message was called due to a short disconnect by the
|
|
296
|
+
// peer to the broker - issuing a lastWill message by the broker.
|
|
297
|
+
// by giving it some time the housekeeping process will verify if the peer
|
|
298
|
+
// is still online or if it is really gone..
|
|
299
|
+
setTimeout(this.startHousekeeping, houseKeepingTimeOut_onPeerLeft);
|
|
300
|
+
} else {
|
|
301
|
+
console.log(`!!! >BAD PLAYER<: somebody tried to remove peer without proper credentials!!!`);
|
|
302
|
+
}
|
|
300
303
|
}
|
|
301
304
|
};
|
|
302
305
|
|
package/lib/connect/MQTTBus.js
CHANGED
|
@@ -83,7 +83,9 @@ class MqttNetBus {
|
|
|
83
83
|
|
|
84
84
|
disconnect = async () => {
|
|
85
85
|
if(this.isConnected){
|
|
86
|
-
|
|
86
|
+
// we need to force end the connection
|
|
87
|
+
// probably because of subscriptions with QoS = 2
|
|
88
|
+
await this.mqttClient.end(true);
|
|
87
89
|
}
|
|
88
90
|
this.isConnected = false;
|
|
89
91
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "telemersive-bus",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
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": {
|