configurapi-runner-ws 1.12.0 → 1.13.0
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/package.json +1 -1
- package/src/index.js +10 -9
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -142,15 +142,6 @@ module.exports = class HttpRunner extends events.EventEmitter
|
|
|
142
142
|
}
|
|
143
143
|
this.emit("trace", `[connect] ${connectionId}`);
|
|
144
144
|
|
|
145
|
-
if (config.events.has('on_connect'))
|
|
146
|
-
{
|
|
147
|
-
const response = await this._requestListener(ws, undefined, 'on_connect');
|
|
148
|
-
|
|
149
|
-
if (response.statusCode >= 400)
|
|
150
|
-
{
|
|
151
|
-
return ws.close(1008, 'Policy Violation');
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
145
|
ws.on("message", async (data) =>
|
|
155
146
|
{
|
|
156
147
|
const incomingMessage = typeof data === "string" ? data : data.toString("utf8");
|
|
@@ -175,6 +166,16 @@ module.exports = class HttpRunner extends events.EventEmitter
|
|
|
175
166
|
const message = err instanceof Error ? err.message : err;
|
|
176
167
|
this.emit("error", `${connectionId} - ${message}`);
|
|
177
168
|
});
|
|
169
|
+
|
|
170
|
+
if (config.events.has('on_connect'))
|
|
171
|
+
{
|
|
172
|
+
const response = await this._requestListener(ws, undefined, 'on_connect');
|
|
173
|
+
|
|
174
|
+
if (response.statusCode >= 400)
|
|
175
|
+
{
|
|
176
|
+
return ws.close(1008, 'Policy Violation');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
178
179
|
});
|
|
179
180
|
}
|
|
180
181
|
|