Kaynağa Gözat

refactor to handle subscription session and form separately

thomas 3 yıl önce
ebeveyn
işleme
8cb11d00e2

+ 16 - 4
package-lock.json

@@ -10,6 +10,7 @@
       "dependencies": {
         "core-js": "^3.6.5",
         "jsonschema": "^1.4.0",
+        "lodash": "^4.17.21",
         "rfdc": "^1.1.4",
         "rxjs": "^6.6.7",
         "socket.io-client": "^2.4.0",
@@ -19,6 +20,7 @@
         "vue-property-decorator": "^9.1.2"
       },
       "devDependencies": {
+        "@types/lodash": "^4.14.170",
         "@types/rfdc": "^1.1.0",
         "@types/uuid": "^8.3.0",
         "@typescript-eslint/eslint-plugin": "^4.27.0",
@@ -1840,6 +1842,12 @@
       "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==",
       "dev": true
     },
+    "node_modules/@types/lodash": {
+      "version": "4.14.170",
+      "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.170.tgz",
+      "integrity": "sha512-bpcvu/MKHHeYX+qeEN8GE7DIravODWdACVA1ctevD8CN24RhPZIKMn9ntfAsrvLfSX3cR5RrBKAbYm9bGs0A+Q==",
+      "dev": true
+    },
     "node_modules/@types/mime": {
       "version": "1.3.2",
       "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz",
@@ -9686,8 +9694,7 @@
     "node_modules/lodash": {
       "version": "4.17.21",
       "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
-      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
-      "dev": true
+      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
     },
     "node_modules/lodash.debounce": {
       "version": "4.0.8",
@@ -17922,6 +17929,12 @@
       "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==",
       "dev": true
     },
+    "@types/lodash": {
+      "version": "4.14.170",
+      "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.170.tgz",
+      "integrity": "sha512-bpcvu/MKHHeYX+qeEN8GE7DIravODWdACVA1ctevD8CN24RhPZIKMn9ntfAsrvLfSX3cR5RrBKAbYm9bGs0A+Q==",
+      "dev": true
+    },
     "@types/mime": {
       "version": "1.3.2",
       "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz",
@@ -24120,8 +24133,7 @@
     "lodash": {
       "version": "4.17.21",
       "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
-      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
-      "dev": true
+      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
     },
     "lodash.debounce": {
       "version": "4.0.8",

+ 2 - 0
package.json

@@ -10,6 +10,7 @@
   "dependencies": {
     "core-js": "^3.6.5",
     "jsonschema": "^1.4.0",
+    "lodash": "^4.17.21",
     "rfdc": "^1.1.4",
     "rxjs": "^6.6.7",
     "socket.io-client": "^2.4.0",
@@ -19,6 +20,7 @@
     "vue-property-decorator": "^9.1.2"
   },
   "devDependencies": {
+    "@types/lodash": "^4.14.170",
     "@types/rfdc": "^1.1.0",
     "@types/uuid": "^8.3.0",
     "@typescript-eslint/eslint-plugin": "^4.27.0",

+ 33 - 13
src/assets/js/__transport.socketio.js

@@ -11,21 +11,41 @@ export class TestSocketIoClient {
     this.socket.disconnect();
   }
 
-  connect(url) {
-    this.responses = new Subject()
+  async connect(url, options = {} ) {
+    const self = this;
+    return new Promise((resolve, reject) =>{
+      this.responses = new Subject()
+  
+      const ws = io.connect(url, options)
+            
+      // ws.on('connecting',     (x) => { console.info('connecting', x);     });
+      // ws.on('connect_failed', (x) => { console.info('connect_failed',x);  });
+      // ws.on('error',          (x) => { console.info('error', x);          });
+      // ws.on('disconnect',     (x) => { console.info('disconnect',x);      });
 
-    const ws = io.connect(url)
+      // https://socket.io/docs/v2/client-api/#Event-%E2%80%98connect-error%E2%80%99
+      
+      // ws.on('pong',              (x) => { console.info('pong',x);                });
+      // ws.on('ping',              (x) => { console.info('ping',x);                });
+      // ws.on('reconnect_failed',  (x) => { console.info('reconnect_failed', x);   });
+      // ws.on('reconnecting',      (x) => { console.info('reconnecting', x);       });
+      // ws.on('reconnect_attempt', (x) => { console.info('reconnect_attempt', x);  });
+      // ws.on('reconnect',         (x) => { console.info('reconnect', x);          });
+      // ws.on('connect_timeout',   (x) => { console.info('connect_timeout',x);     });
+      ws.on('connect_error', (x) => {
+        console.info('connect_error',x);
+        reject(x)
+      });
 
-    ws.on('connecting',     (x) => { console.info('connecting', x);     });
-    ws.on('reconnecting',   (x) => { console.info('reconnecting', x);   });
-    ws.on('connect_failed', (x) => { console.info('connect_failed',x);  });
-    ws.on('error',          (x) => { console.info('error', x);          });
-    ws.on('disconnect',     (x) => { console.info('disconnect',x);      });
-    ws.on('connect',        (x) => { console.info('connect', x)         });
-    
-    ws.on('response', (data) => { this.responses.next(data)  });
-
-    this.socket = ws;
+      ws.on('connect', (x) => {
+        console.info('connect', ws.id)
+        this.socket = ws;
+        resolve(ws.id)
+      });
+      
+      ws.on('response', (data) => { this.responses.next(data)  });
+      
+    })
   }
 
   getStreamOfResponsesFromRequest(request) {

Dosya farkı çok büyük olduğundan ihmal edildi
+ 3 - 5
src/components/UIClient.vue


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor