@trap_stevo/filetide-client 0.0.14 → 0.0.16

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.
@@ -162,7 +162,14 @@ class FileTideClient {
162
162
  FileTide.outputGradient(`[${this.deviceName}] Disconnected from the file net.`, ["#00C897", "#00E0FF"]);
163
163
  }
164
164
  }
165
- startClient(clientOptions = {}, connectionOptions = {}, onConnect = null, ...clientConfigurations) {
165
+ startClient(clientOptions = {}, connectionOptions = {}, transportOptions = {
166
+ parallelChunks: 3,
167
+ maxRetries: 3
168
+ }, messagerSettings = {
169
+ maxReconnectionAttempts: 15,
170
+ reconnectionAttempts: 15,
171
+ maxReconnectionDelay: 10000
172
+ }, onConnect = null, onDisconnect = null, ...clientConfigurations) {
166
173
  const launchClient = () => {
167
174
  if (this.fileMessagerInstance && this.fileMessagerInstance.clientTide) {
168
175
  this.fileMessagerInstance.clientTide.closeSocket(this.deviceName);
@@ -175,7 +182,7 @@ class FileTideClient {
175
182
  pingTimeout: 3600000,
176
183
  pingInterval: 60000,
177
184
  ...connectionOptions
178
- }, this.currentRoom, this.deviceName, (fileMessager, enterRoom) => {
185
+ }, transportOptions, messagerSettings, this.currentRoom, this.deviceName, (fileMessager, enterRoom) => {
179
186
  this.fileMessagerInstance = fileMessager;
180
187
  this.connectionID = null;
181
188
  fileMessager.clientTide.onEvent(this.deviceName, "connect", async () => {
@@ -198,6 +205,9 @@ class FileTideClient {
198
205
  });
199
206
  fileMessager.clientTide.onEvent(this.deviceName, "disconnect", () => {
200
207
  this.broadcastClientOffline(fileMessager);
208
+ if (onDisconnect) {
209
+ onDisconnect(this.deviceName, this.connectionID, this.tideUrl);
210
+ }
201
211
  });
202
212
  }, ...clientConfigurations);
203
213
  };
@@ -257,7 +267,7 @@ class FileTideClient {
257
267
  changeRoom(room, completion, onReconnect) {
258
268
  this.currentRoom = room;
259
269
  FileTide.outputGradient(`[${this.deviceName}] Updated room to ${this.currentRoom}`, ["#4D96FF", "#89CFF0"]);
260
- this.startClient({}, {}, onReconnect);
270
+ this.startClient({}, {}, {}, {}, onReconnect);
261
271
  if (completion) {
262
272
  completion(room, true);
263
273
  }
@@ -275,7 +285,7 @@ class FileTideClient {
275
285
  this.deviceName = clientID;
276
286
  this.fileMessagerInstance.clientTide.emitEvent(this.currentDeviceName, "client-offline", this.currentDeviceName);
277
287
  FileTide.outputGradient(`[${this.deviceName}] Updated client name to ${this.deviceName}`, ["#4D96FF", "#89CFF0"]);
278
- this.startClient({}, {}, onReconnect);
288
+ this.startClient({}, {}, {}, {}, onReconnect);
279
289
  updatedClientID = true;
280
290
  }
281
291
  if (completion) {
@@ -286,7 +296,7 @@ class FileTideClient {
286
296
  changeTideUrl(url, completion, onReconnect) {
287
297
  this.tideUrl = url;
288
298
  FileTide.outputGradient(`[${this.deviceName}] Updated tide URL to ${this.tideUrl}`, ["#4D96FF", "#89CFF0"]);
289
- this.startClient({}, {}, onReconnect);
299
+ this.startClient({}, {}, {}, {}, onReconnect);
290
300
  if (completion) {
291
301
  completion(url, true);
292
302
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trap_stevo/filetide-client",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
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,9 +37,9 @@
37
37
  "author": "Steven Compton",
38
38
  "license": "See License in LICENSE.md",
39
39
  "dependencies": {
40
- "@trap_stevo/filetide": "^0.0.45",
40
+ "@trap_stevo/filetide": "^0.0.46",
41
41
  "@trap_stevo/iotide": "^0.0.37",
42
- "@trap_stevo/legendarybuilderpronodejs-utilities": "^1.0.36",
42
+ "@trap_stevo/legendarybuilderpronodejs-utilities": "^1.0.43",
43
43
  "chalk": "^4.1.2",
44
44
  "readline": "^1.3.0"
45
45
  },