@trap_stevo/filetide-client 0.0.24 → 0.0.26

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.
@@ -110,6 +110,17 @@ class FileTideClient {
110
110
  this.shortcuts = shortcuts;
111
111
  this.connectionID = null;
112
112
  _assertClassBrand(_FileTideClient_brand, this, _setupProcessEvents).call(this);
113
+ this.messagerSettings = {
114
+ maxReconnectionAttempts: 15,
115
+ reconnectionAttempts: 15,
116
+ maxReconnectionDelay: 10000
117
+ };
118
+ this.transportOptions = {
119
+ parallelChunks: 3,
120
+ maxRetries: 3
121
+ };
122
+ this.connectionOptions = {};
123
+ this.clientOptions = {};
113
124
  if (displayTitle) {
114
125
  this.displayTitle(showCLITitle);
115
126
  }
@@ -173,6 +184,7 @@ class FileTideClient {
173
184
  }, onConnect = null, onDisconnect = null, ...clientConfigurations) {
174
185
  const launchClient = () => {
175
186
  if (this.fileMessagerInstance && this.fileMessagerInstance.clientTide) {
187
+ this.broadcastClientOffline(this.fileMessagerInstance);
176
188
  this.fileMessagerInstance.clientTide.closeSocket(this.deviceName);
177
189
  }
178
190
  fileTide.launchMessager({
@@ -212,6 +224,10 @@ class FileTideClient {
212
224
  });
213
225
  }, ...clientConfigurations);
214
226
  };
227
+ this.connectionOptions = connectionOptions;
228
+ this.transportOptions = transportOptions;
229
+ this.messagerSettings = messagerSettings;
230
+ this.clientOptions = clientOptions;
215
231
  launchClient();
216
232
  }
217
233
  requestFileTransfer(senderID, filePath, destinationPath, filterContent = [], transferRequestExpirationTime = 30000) {
@@ -268,7 +284,7 @@ class FileTideClient {
268
284
  changeRoom(room, completion, onReconnect) {
269
285
  this.currentRoom = room;
270
286
  FileTide.outputGradient(`[${this.deviceName}] Updated room to ${this.currentRoom}`, ["#4D96FF", "#89CFF0"]);
271
- this.startClient({}, {}, {}, {}, onReconnect);
287
+ this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect);
272
288
  if (completion) {
273
289
  completion(room, true);
274
290
  }
@@ -284,10 +300,16 @@ class FileTideClient {
284
300
  } else if (!clientOnline || !clientOnline.online || clientOnline.client.id === this.connectionID) {
285
301
  const pDeviceName = this.deviceName;
286
302
  this.currentDeviceName = pDeviceName;
287
- this.fileMessagerInstance.clientTide.emitEvent(this.currentDeviceName || pDeviceName, "client-offline", this.currentDeviceName || pDeviceName);
303
+ this.clientDisconnected = true;
304
+ const transferStates = fileTide.getTidingTransferStates();
305
+ this.fileMessagerInstance.clientTide.emitEvent(this.currentDeviceName || pDeviceName, "client-offline", {
306
+ clientID: this.currentDeviceName || pDeviceName,
307
+ connectionID: this.connectionID,
308
+ disconnectedDuringTransfer: transferStates.size > 0 ? true : false
309
+ });
288
310
  this.deviceName = clientID;
289
311
  FileTide.outputGradient(`[${this.deviceName}] Updated client name to ${this.deviceName}`, ["#4D96FF", "#89CFF0"]);
290
- this.startClient({}, {}, {}, {}, onReconnect);
312
+ this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect);
291
313
  updatedClientID = true;
292
314
  }
293
315
  if (completion) {
@@ -298,7 +320,7 @@ class FileTideClient {
298
320
  changeTideUrl(url, completion, onReconnect) {
299
321
  this.tideUrl = url;
300
322
  FileTide.outputGradient(`[${this.deviceName}] Updated tide URL to ${this.tideUrl}`, ["#4D96FF", "#89CFF0"]);
301
- this.startClient({}, {}, {}, {}, onReconnect);
323
+ this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect);
302
324
  if (completion) {
303
325
  completion(url, true);
304
326
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trap_stevo/filetide-client",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
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": {