@trap_stevo/filetide 0.0.11 → 0.0.13

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.
@@ -15,17 +15,18 @@ class FileMessagerClient {
15
15
  this.clientTide = new HUDIoTide();
16
16
  this.clients = new Map();
17
17
  }
18
- createClientInstance(clientID, clientOptions) {
18
+ createClientInstance(clientID, clientOptions, options = {}) {
19
19
  this.clientTide.createIO(clientID, clientOptions.url, {
20
- transports: ["websocket"]
20
+ transports: ["websocket"],
21
+ ...options
21
22
  });
22
23
  console.log(`[FileTide ~ File Messager] ~ Created client with ID ${clientID} and socket ${clientID}!`);
23
24
  return clientID;
24
25
  }
25
- joinRoom(userID, roomName) {
26
+ joinRoom(userID, roomName, options = {}) {
26
27
  const socketName = this.createClientInstance(userID, {
27
28
  url: this.clientOptions.url
28
- });
29
+ }, options);
29
30
  this.clientTide.joinChannel(socketName, roomName, userID, () => {
30
31
  console.log(`[FileTide ~ File Messager] ~ Client ~ ${userID} joined room ${roomName} successfully!`);
31
32
  this.clients.set(userID, {
@@ -37,16 +37,17 @@ class FileTide {
37
37
  /**
38
38
  * Initialize and start a new client for each user.
39
39
  * @param {Object} clientOptions - Configuration for client (e.g., serverUrl)
40
+ * @param {Object} connectionOptions - Configuration for the client connection
40
41
  * @param {String} roomName - The name of the room to join
41
42
  * @param {String} userID - The ID of the client user
42
43
  * @param {Function} onLaunch - Callback for when a file messager launches
43
44
  */
44
- launchMessager(clientOptions = {}, roomName, userID, onLaunch, onIncomingFile) {
45
+ launchMessager(clientOptions = {}, connectionOptions = {}, roomName, userID, onLaunch, onIncomingFile) {
45
46
  if (this.clients.has(userID)) {
46
47
  this.stopMessager(userID);
47
48
  }
48
49
  const newClient = new FileMessagerClient(clientOptions);
49
- newClient.joinRoom(userID, roomName);
50
+ newClient.joinRoom(userID, roomName, connectionOptions);
50
51
  newClient.handleMultipleClientsTransfer();
51
52
  this.clients.set(userID, newClient);
52
53
  console.log(`[FileTide] ~ Messager launched successfully for client ~ ${userID}!`);
@@ -2,16 +2,18 @@
2
2
 
3
3
  class FileMessagerConfigManager {
4
4
  static getServerOptions({
5
- port = 9269,
6
- useCors = true,
5
+ maxHttpBufferSize = 1e9,
7
6
  useHTTPS = false,
8
7
  corsOrigin = "*",
8
+ useCors = true,
9
+ port = 9269,
9
10
  ...rest
10
11
  } = {}) {
11
12
  return {
12
- port,
13
- useCors,
13
+ maxHttpBufferSize,
14
14
  useHTTPS,
15
+ useCors,
16
+ port,
15
17
  socketOptions: {
16
18
  cors: {
17
19
  origin: corsOrigin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trap_stevo/filetide",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "Revolutionizing real-time file transfer with seamless, instant communication across any device. Deliver files instantly, regardless of platform, and experience unparalleled speed and control in managing transfers. Elevate your file-sharing capabilities with a tool designed for precision, efficiency, and effortless connectivity.",
5
5
  "main": "dist/cjs/FileTide.js",
6
6
  "scripts": {