camstreamerlib 1.8.6 → 1.8.7

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/CamOverlayAPI.js CHANGED
@@ -180,8 +180,8 @@ class CamOverlayAPI extends EventEmitter {
180
180
  reject(error);
181
181
  });
182
182
  this.ws.on('close', () => {
183
- this.reportClose();
184
183
  clearInterval(pingTimer);
184
+ this.reportClose();
185
185
  });
186
186
  });
187
187
  return promise;
package/HTTPRequest.js CHANGED
@@ -14,12 +14,13 @@ const http = require("http");
14
14
  const https = require("https");
15
15
  const Digest_1 = require("./Digest");
16
16
  function httpRequest(options, postData, noWaitForData = false) {
17
- var _a, _b;
18
- var _c;
17
+ var _a, _b, _c;
18
+ var _d;
19
19
  return __awaiter(this, void 0, void 0, function* () {
20
+ options.timeout = (_a = options.timeout) !== null && _a !== void 0 ? _a : 10000;
20
21
  if (postData !== undefined) {
21
- (_a = options.headers) !== null && _a !== void 0 ? _a : (options.headers = {});
22
- (_b = (_c = options.headers)['Content-Type']) !== null && _b !== void 0 ? _b : (_c['Content-Type'] = 'application/x-www-form-urlencoded');
22
+ (_b = options.headers) !== null && _b !== void 0 ? _b : (options.headers = {});
23
+ (_c = (_d = options.headers)['Content-Type']) !== null && _c !== void 0 ? _c : (_d['Content-Type'] = 'application/x-www-form-urlencoded');
23
24
  options.headers['Content-Length'] = Buffer.byteLength(postData);
24
25
  }
25
26
  let response = yield request(options, postData, undefined, noWaitForData);
@@ -76,6 +77,9 @@ function request(options, postData, digestHeader, noWaitForData) {
76
77
  .on('error', (err) => {
77
78
  reject(err);
78
79
  });
80
+ req.on('timeout', () => {
81
+ req.destroy(new Error('Request timeout'));
82
+ });
79
83
  if (postData != undefined) {
80
84
  req.write(postData);
81
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "1.8.6",
3
+ "version": "1.8.7",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "dependencies": {