@trap_stevo/filetide-client 0.0.26 → 0.0.27

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.
@@ -183,7 +183,7 @@ class FileTideClient {
183
183
  maxReconnectionDelay: 10000
184
184
  }, onConnect = null, onDisconnect = null, ...clientConfigurations) {
185
185
  const launchClient = () => {
186
- if (this.fileMessagerInstance && this.fileMessagerInstance.clientTide) {
186
+ if (this.fileMessagerInstance && this.fileMessagerInstance.clientTide && this.fileMessagerInstance.clientTide.tideExists(this.deviceName)) {
187
187
  this.broadcastClientOffline(this.fileMessagerInstance);
188
188
  this.fileMessagerInstance.clientTide.closeSocket(this.deviceName);
189
189
  }
@@ -202,7 +202,7 @@ class FileTideClient {
202
202
  this.clientDisconnected = false;
203
203
  this.connectionID = fileMessager.clientTide.sockets[this.deviceName].id;
204
204
  FileTide.outputGradient(`[${this.deviceName}] Connected to FileTide ~ ${this.tideUrl} in ${this.currentRoom}!`, ["#00C897", "#00E0FF"]);
205
- fileMessager.clientTide.emitEvent(this.deviceName, "client-online", this.deviceName, fileMessager.clientTide.sockets[this.deviceName].tideID, this.pDeviceName, fileMessager.clientTide.sockets[this.deviceName].id);
205
+ fileMessager.clientTide.emitEvent(this.deviceName, "client-online", this.deviceName, fileMessager.clientTide.sockets[this.deviceName].tideID, this.pDeviceName, fileMessager.clientTide.sockets[this.deviceName].id, fileTide.transferBarrier, this.originDeviceName, this.currentRoom);
206
206
  const clientOnline = await fileMessager.clientTide.emitEventWithResponse(this.deviceName, "check-client-online", "retrieved-client-online", {
207
207
  clientID: this.deviceName
208
208
  }, 5000);
@@ -217,7 +217,9 @@ class FileTideClient {
217
217
  }
218
218
  });
219
219
  fileMessager.clientTide.onEvent(this.deviceName, "disconnect", () => {
220
- this.broadcastClientOffline(fileMessager);
220
+ if (this.fileMessagerInstance.clientTide.tideExists(this.deviceName)) {
221
+ this.broadcastClientOffline(fileMessager);
222
+ }
221
223
  if (onDisconnect) {
222
224
  onDisconnect(this.deviceName, this.connectionID, this.tideUrl);
223
225
  }
@@ -302,13 +304,14 @@ class FileTideClient {
302
304
  this.currentDeviceName = pDeviceName;
303
305
  this.clientDisconnected = true;
304
306
  const transferStates = fileTide.getTidingTransferStates();
305
- this.fileMessagerInstance.clientTide.emitEvent(this.currentDeviceName || pDeviceName, "client-offline", {
306
- clientID: this.currentDeviceName || pDeviceName,
307
+ this.fileMessagerInstance.clientTide.emitEvent(pDeviceName, "client-offline", {
308
+ clientID: pDeviceName,
307
309
  connectionID: this.connectionID,
308
310
  disconnectedDuringTransfer: transferStates.size > 0 ? true : false
309
311
  });
312
+ this.fileMessagerInstance.clientTide.closeSocket(this.deviceName);
310
313
  this.deviceName = clientID;
311
- FileTide.outputGradient(`[${this.deviceName}] Updated client name to ${this.deviceName}`, ["#4D96FF", "#89CFF0"]);
314
+ FileTide.outputGradient(`[${pDeviceName}] Updated client name to ${this.deviceName}`, ["#4D96FF", "#89CFF0"]);
312
315
  this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect);
313
316
  updatedClientID = true;
314
317
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trap_stevo/filetide-client",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "description": "Seamless, real-time file transfers between devices with effortless connectivity. Allowing for powerful, instant, secure, and cross-platform file sharing, enabling efficient and reliable data transfers in any network environment.",
5
5
  "main": "dist/cjs/FileTideClient.js",
6
6
  "exports": {
@@ -37,7 +37,7 @@
37
37
  "author": "Steven Compton",
38
38
  "license": "See License in LICENSE.md",
39
39
  "dependencies": {
40
- "@trap_stevo/filetide": "^0.0.54",
40
+ "@trap_stevo/filetide": "^0.0.55",
41
41
  "@trap_stevo/iotide": "^0.0.41",
42
42
  "@trap_stevo/legendarybuilderpronodejs-utilities": "^1.0.43",
43
43
  "chalk": "^4.1.2",