@trap_stevo/filetide-client 0.0.25 → 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.
- package/dist/cjs/FileTideClient.js +28 -9
- package/package.json +2 -2
|
@@ -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
|
}
|
|
@@ -172,7 +183,8 @@ class FileTideClient {
|
|
|
172
183
|
maxReconnectionDelay: 10000
|
|
173
184
|
}, onConnect = null, onDisconnect = null, ...clientConfigurations) {
|
|
174
185
|
const launchClient = () => {
|
|
175
|
-
if (this.fileMessagerInstance && this.fileMessagerInstance.clientTide) {
|
|
186
|
+
if (this.fileMessagerInstance && this.fileMessagerInstance.clientTide && this.fileMessagerInstance.clientTide.tideExists(this.deviceName)) {
|
|
187
|
+
this.broadcastClientOffline(this.fileMessagerInstance);
|
|
176
188
|
this.fileMessagerInstance.clientTide.closeSocket(this.deviceName);
|
|
177
189
|
}
|
|
178
190
|
fileTide.launchMessager({
|
|
@@ -190,7 +202,7 @@ class FileTideClient {
|
|
|
190
202
|
this.clientDisconnected = false;
|
|
191
203
|
this.connectionID = fileMessager.clientTide.sockets[this.deviceName].id;
|
|
192
204
|
FileTide.outputGradient(`[${this.deviceName}] Connected to FileTide ~ ${this.tideUrl} in ${this.currentRoom}!`, ["#00C897", "#00E0FF"]);
|
|
193
|
-
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);
|
|
194
206
|
const clientOnline = await fileMessager.clientTide.emitEventWithResponse(this.deviceName, "check-client-online", "retrieved-client-online", {
|
|
195
207
|
clientID: this.deviceName
|
|
196
208
|
}, 5000);
|
|
@@ -205,13 +217,19 @@ class FileTideClient {
|
|
|
205
217
|
}
|
|
206
218
|
});
|
|
207
219
|
fileMessager.clientTide.onEvent(this.deviceName, "disconnect", () => {
|
|
208
|
-
this.
|
|
220
|
+
if (this.fileMessagerInstance.clientTide.tideExists(this.deviceName)) {
|
|
221
|
+
this.broadcastClientOffline(fileMessager);
|
|
222
|
+
}
|
|
209
223
|
if (onDisconnect) {
|
|
210
224
|
onDisconnect(this.deviceName, this.connectionID, this.tideUrl);
|
|
211
225
|
}
|
|
212
226
|
});
|
|
213
227
|
}, ...clientConfigurations);
|
|
214
228
|
};
|
|
229
|
+
this.connectionOptions = connectionOptions;
|
|
230
|
+
this.transportOptions = transportOptions;
|
|
231
|
+
this.messagerSettings = messagerSettings;
|
|
232
|
+
this.clientOptions = clientOptions;
|
|
215
233
|
launchClient();
|
|
216
234
|
}
|
|
217
235
|
requestFileTransfer(senderID, filePath, destinationPath, filterContent = [], transferRequestExpirationTime = 30000) {
|
|
@@ -268,7 +286,7 @@ class FileTideClient {
|
|
|
268
286
|
changeRoom(room, completion, onReconnect) {
|
|
269
287
|
this.currentRoom = room;
|
|
270
288
|
FileTide.outputGradient(`[${this.deviceName}] Updated room to ${this.currentRoom}`, ["#4D96FF", "#89CFF0"]);
|
|
271
|
-
this.startClient(
|
|
289
|
+
this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect);
|
|
272
290
|
if (completion) {
|
|
273
291
|
completion(room, true);
|
|
274
292
|
}
|
|
@@ -286,14 +304,15 @@ class FileTideClient {
|
|
|
286
304
|
this.currentDeviceName = pDeviceName;
|
|
287
305
|
this.clientDisconnected = true;
|
|
288
306
|
const transferStates = fileTide.getTidingTransferStates();
|
|
289
|
-
this.fileMessagerInstance.clientTide.emitEvent(
|
|
290
|
-
clientID:
|
|
307
|
+
this.fileMessagerInstance.clientTide.emitEvent(pDeviceName, "client-offline", {
|
|
308
|
+
clientID: pDeviceName,
|
|
291
309
|
connectionID: this.connectionID,
|
|
292
310
|
disconnectedDuringTransfer: transferStates.size > 0 ? true : false
|
|
293
311
|
});
|
|
312
|
+
this.fileMessagerInstance.clientTide.closeSocket(this.deviceName);
|
|
294
313
|
this.deviceName = clientID;
|
|
295
|
-
FileTide.outputGradient(`[${
|
|
296
|
-
this.startClient(
|
|
314
|
+
FileTide.outputGradient(`[${pDeviceName}] Updated client name to ${this.deviceName}`, ["#4D96FF", "#89CFF0"]);
|
|
315
|
+
this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect);
|
|
297
316
|
updatedClientID = true;
|
|
298
317
|
}
|
|
299
318
|
if (completion) {
|
|
@@ -304,7 +323,7 @@ class FileTideClient {
|
|
|
304
323
|
changeTideUrl(url, completion, onReconnect) {
|
|
305
324
|
this.tideUrl = url;
|
|
306
325
|
FileTide.outputGradient(`[${this.deviceName}] Updated tide URL to ${this.tideUrl}`, ["#4D96FF", "#89CFF0"]);
|
|
307
|
-
this.startClient(
|
|
326
|
+
this.startClient(this.clientOptions, this.connectionOptions, this.transportOptions, this.messagerSettings, onReconnect);
|
|
308
327
|
if (completion) {
|
|
309
328
|
completion(url, true);
|
|
310
329
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trap_stevo/filetide-client",
|
|
3
|
-
"version": "0.0.
|
|
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.
|
|
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",
|