Browse Source

some minor fixes

enzo 3 weeks ago
parent
commit
48a52f3e0e
6 changed files with 13 additions and 13 deletions
  1. 1 1
      dist/config/config.json
  2. 1 1
      package.json
  3. 1 1
      src/config/config.json
  4. 3 3
      src/test/proxy.ts
  5. 3 3
      src/test/transmitter.ts
  6. 4 4
      src/utils/socket.utils.ts

+ 1 - 1
dist/config/config.json

@@ -1,5 +1,5 @@
 {
     "connection": {
-        "transmitter": "http://localhost:3000/"
+        "transmitter": "http://localhost:3001/"
     }
 }

+ 1 - 1
package.json

@@ -35,4 +35,4 @@
     "source-map-support": "^0.5.21",
     "uuid": "^10.0.0"
   }
-}
+}

+ 1 - 1
src/config/config.json

@@ -1,5 +1,5 @@
 {
     "connection": {
-        "transmitter": "http://localhost:3000/"
+        "transmitter": "http://localhost:3001/"
     }
 }

+ 3 - 3
src/test/proxy.ts

@@ -7,10 +7,10 @@ import http, { IncomingMessage, ServerResponse } from 'http';
 let fromServer = new Subject<{ event: 'profile' | 'message', payload: any }>()
 let toServer = new Subject<{ event: 'profile' | 'message', payload: any }>()
 
-// startSocketServer(3001)
+startSocketServer(3001)
 // startSocketServer(3002)
-// startClientSocketConnection('http://localhost:3000')
-startHttpServer(3001, 'http://localhost:3000/response')
+startClientSocketConnection('http://localhost:3000')
+// startHttpServer(3001, 'http://localhost:3000/response')
 consoleLog()
 
 function consoleLog(): void {

+ 3 - 3
src/test/transmitter.ts

@@ -41,9 +41,9 @@ class Supervisor {
         })
 
         // to emulate general notification. Send every second
-        // this.messageProducer.getNotificationMessage().subscribe((message: FisMessage) => {
-        //     messageTransmission.transmitter.emit(message)
-        // })
+        this.messageProducer.getNotificationMessage().subscribe((message: FisMessage) => {
+            messageTransmission.transmitter.emit(message)
+        })
     }
 }
 

+ 4 - 4
src/utils/socket.utils.ts

@@ -321,7 +321,7 @@ export async function checkIfClientExists(id: string): Promise<ConnectedSocketCl
             // Check if the file exists
             let filePath = process.env.FolderPath as string + 'clients.json'
             if (!fs.existsSync(filePath)) {
-                console.log({ message: "File does not exist." })
+                console.log({ message: `File does not exist.` })
                 reject('File does not exist');
             }
 
@@ -349,10 +349,10 @@ export async function checkIfClientExists(id: string): Promise<ConnectedSocketCl
 export async function checkOwnClientInfo(filename?: string): Promise<{ id: string }> {
     return new Promise((resolve, reject) => {
         // Check if the file exists
-        if (fs.existsSync(`${filename}.json`)) {
+        let filePath = process.env.FolderPath as string
+        if (fs.existsSync(`${filePath}${filename}.json`)) {
             try {
                 // Read the file contents
-                let filePath = process.env.FolderPath as string
                 const fileData = fs.readFileSync(filePath + `${filename}.json`, 'utf8');
 
                 // If the file is empty, return an error
@@ -370,7 +370,7 @@ export async function checkOwnClientInfo(filename?: string): Promise<{ id: strin
                 reject('');
             }
         } else {
-            console.log({ message: "File does not exist" })
+            console.log({ message: `File does not exist. Id: ${filename}` })
             reject('');
         }
     })