@gudhub/core 1.1.134 → 1.1.136
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.
|
@@ -1003,6 +1003,24 @@ export default function generateModulesList(async_modules_path, file_server_url,
|
|
|
1003
1003
|
type: 'gh_element',
|
|
1004
1004
|
technology: 'angular'
|
|
1005
1005
|
},
|
|
1006
|
+
{
|
|
1007
|
+
data_type: "agent_constructor",
|
|
1008
|
+
private: true,
|
|
1009
|
+
name: 'Agent Constructor',
|
|
1010
|
+
icon: 'app_constructor',
|
|
1011
|
+
url: file_server_url + '/' + async_modules_path + "agent_constructor_action.js",
|
|
1012
|
+
type: 'gh_element',
|
|
1013
|
+
technology: 'angular'
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
data_type: "invitation",
|
|
1017
|
+
private: true,
|
|
1018
|
+
name: 'Invitation',
|
|
1019
|
+
icon: 'app_constructor',
|
|
1020
|
+
url: file_server_url + '/' + async_modules_path + "invitation_action.js",
|
|
1021
|
+
type: 'gh_element',
|
|
1022
|
+
technology: 'angular'
|
|
1023
|
+
},
|
|
1006
1024
|
// {
|
|
1007
1025
|
// data_type: "visualizer_with_control_panel",
|
|
1008
1026
|
// name: "Visualizer With Control Panel",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Websocket from "ws";
|
|
2
|
+
import { IS_BROWSER_MAIN_THREAD } from "../consts.js";
|
|
2
3
|
|
|
3
4
|
export class WebSocketApi {
|
|
4
5
|
constructor(url, auth) {
|
|
@@ -11,7 +12,7 @@ export class WebSocketApi {
|
|
|
11
12
|
this.ALLOWED_HEART_BEAT_DELEY = 12000;
|
|
12
13
|
this.firstHeartBeat = true;
|
|
13
14
|
this.reload = true;
|
|
14
|
-
this.isBrowser =
|
|
15
|
+
this.isBrowser = IS_BROWSER_MAIN_THREAD;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
async addSubscription(app_id) {
|
|
@@ -58,7 +59,8 @@ export class WebSocketApi {
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
async onMessage(event) {
|
|
61
|
-
|
|
62
|
+
// Browser WebSocket passes MessageEvent (data in event.data), Node.js ws passes raw Buffer
|
|
63
|
+
const message = this.isBrowser ? event.data : event.toString()
|
|
62
64
|
if (message.match(/HeartBeat/)) {
|
|
63
65
|
const hartBeatDelay = new Date().getTime() - this.heartBeatTimeStemp;
|
|
64
66
|
|
|
@@ -100,13 +102,13 @@ export class WebSocketApi {
|
|
|
100
102
|
this.websocket.onmessage = this.onMessage.bind(this);
|
|
101
103
|
} else {
|
|
102
104
|
this.websocket = new Websocket(this.url);
|
|
103
|
-
this.websocket.on("open", this.onOpen);
|
|
105
|
+
this.websocket.on("open", this.onOpen.bind(this));
|
|
104
106
|
|
|
105
|
-
this.websocket.on("error", this.onError);
|
|
107
|
+
this.websocket.on("error", this.onError.bind(this));
|
|
106
108
|
|
|
107
|
-
this.websocket.on("close", this.onClose);
|
|
109
|
+
this.websocket.on("close", this.onClose.bind(this));
|
|
108
110
|
|
|
109
|
-
this.websocket.on("message", this.onMessage);
|
|
111
|
+
this.websocket.on("message", this.onMessage.bind(this));
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
console.log("websocket initialized");
|