@trap_stevo/filetide-client 0.0.26 → 0.0.28

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
  }
@@ -281,16 +283,16 @@ class FileTideClient {
281
283
  }
282
284
  return;
283
285
  }
284
- changeRoom(room, completion, onReconnect) {
286
+ changeRoom(room, completion, onReconnect, onDisconnect, ...clientConfigurations) {
285
287
  this.currentRoom = room;
286
288
  FileTide.outputGradient(`[${this.deviceName}] Updated room to ${this.currentRoom}`, ["#4D96FF", "#89CFF0"]);
287
- this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect);
289
+ this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect, onDisconnect, ...clientConfigurations);
288
290
  if (completion) {
289
291
  completion(room, true);
290
292
  }
291
293
  return;
292
294
  }
293
- async changeClientID(clientID, completion, onReconnect) {
295
+ async changeClientID(clientID, completion, onReconnect, onDisconnect, ...clientConfigurations) {
294
296
  const clientOnline = await this.fileMessagerInstance.clientTide.emitEventWithResponse(clientID, "check-client-online", "retrieved-client-online", {
295
297
  clientID
296
298
  }, 5000);
@@ -302,14 +304,15 @@ 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"]);
312
- this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect);
314
+ FileTide.outputGradient(`[${pDeviceName}] Updated client name to ${this.deviceName}`, ["#4D96FF", "#89CFF0"]);
315
+ this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect, onDisconnect, ...clientConfigurations);
313
316
  updatedClientID = true;
314
317
  }
315
318
  if (completion) {
@@ -317,10 +320,10 @@ class FileTideClient {
317
320
  }
318
321
  return;
319
322
  }
320
- changeTideUrl(url, completion, onReconnect) {
323
+ changeTideUrl(url, completion, onReconnect, onDisconnect, ...clientConfigurations) {
321
324
  this.tideUrl = url;
322
325
  FileTide.outputGradient(`[${this.deviceName}] Updated tide URL to ${this.tideUrl}`, ["#4D96FF", "#89CFF0"]);
323
- this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect);
326
+ this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect, onDisconnect, ...clientConfigurations);
324
327
  if (completion) {
325
328
  completion(url, true);
326
329
  }
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.28",
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.56",
41
41
  "@trap_stevo/iotide": "^0.0.41",
42
42
  "@trap_stevo/legendarybuilderpronodejs-utilities": "^1.0.43",
43
43
  "chalk": "^4.1.2",