camstreamerlib 3.4.0 → 3.4.1

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.
@@ -1,9 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import * as EventEmitter from 'events';
3
3
  import { WsOptions } from './internal/common';
4
- export type CamScripterOptions = WsOptions & {
5
- camScripterAcapName?: string;
6
- };
4
+ export type CamScripterOptions = WsOptions;
7
5
  export type TDeclaration = {
8
6
  type?: '' | 'SOURCE' | 'DATA';
9
7
  namespace: string;
@@ -54,7 +52,6 @@ export declare class CamScripterAPICameraEventsGenerator extends EventEmitter {
54
52
  private port;
55
53
  private user;
56
54
  private pass;
57
- private camScripterAcapName;
58
55
  private callId;
59
56
  private sendMessages;
60
57
  private timeoutCheckTimer;
@@ -5,7 +5,7 @@ const EventEmitter = require("events");
5
5
  const WsClient_1 = require("./internal/WsClient");
6
6
  class CamScripterAPICameraEventsGenerator extends EventEmitter {
7
7
  constructor(options) {
8
- var _a, _b, _c, _d, _e, _f, _g;
8
+ var _a, _b, _c, _d, _e, _f;
9
9
  super();
10
10
  this.tls = (_a = options === null || options === void 0 ? void 0 : options.tls) !== null && _a !== void 0 ? _a : false;
11
11
  this.tlsInsecure = (_b = options === null || options === void 0 ? void 0 : options.tlsInsecure) !== null && _b !== void 0 ? _b : false;
@@ -13,7 +13,6 @@ class CamScripterAPICameraEventsGenerator extends EventEmitter {
13
13
  this.port = (_d = options === null || options === void 0 ? void 0 : options.port) !== null && _d !== void 0 ? _d : (this.tls ? 443 : 80);
14
14
  this.user = (_e = options === null || options === void 0 ? void 0 : options.user) !== null && _e !== void 0 ? _e : '';
15
15
  this.pass = (_f = options === null || options === void 0 ? void 0 : options.pass) !== null && _f !== void 0 ? _f : '';
16
- this.camScripterAcapName = (_g = options === null || options === void 0 ? void 0 : options.camScripterAcapName) !== null && _g !== void 0 ? _g : 'camscripter';
17
16
  this.callId = 0;
18
17
  this.sendMessages = {};
19
18
  this.wsConnected = false;
@@ -57,7 +56,7 @@ class CamScripterAPICameraEventsGenerator extends EventEmitter {
57
56
  tls: this.tls,
58
57
  ip: this.ip,
59
58
  port: this.port,
60
- address: `/local/${this.camScripterAcapName}/ws`,
59
+ address: `/local/camscripter/ws`,
61
60
  protocol: 'camera-events',
62
61
  };
63
62
  this.ws = new WsClient_1.WsClient(options);
package/HttpServer.d.ts CHANGED
@@ -3,10 +3,12 @@
3
3
  import * as http from 'http';
4
4
  import * as EventEmitter from 'events';
5
5
  export type HttpServerOptions = {
6
+ host?: string;
6
7
  port?: number;
7
8
  };
8
9
  type TOnRequestCallback = (req: http.IncomingMessage, res: http.ServerResponse) => void;
9
10
  export declare class HttpServer extends EventEmitter {
11
+ private host;
10
12
  private port;
11
13
  private registeredPaths;
12
14
  private server;
package/HttpServer.js CHANGED
@@ -8,9 +8,10 @@ const path = require("path");
8
8
  const EventEmitter = require("events");
9
9
  class HttpServer extends EventEmitter {
10
10
  constructor(options) {
11
- var _a, _b;
11
+ var _a, _b, _c, _d;
12
12
  super();
13
- this.port = (_a = options === null || options === void 0 ? void 0 : options.port) !== null && _a !== void 0 ? _a : parseInt((_b = process.env.HTTP_PORT) !== null && _b !== void 0 ? _b : '80');
13
+ this.host = (_b = (_a = options === null || options === void 0 ? void 0 : options.host) !== null && _a !== void 0 ? _a : process.env.HTTP_HOST) !== null && _b !== void 0 ? _b : '0.0.0.0';
14
+ this.port = (_c = options === null || options === void 0 ? void 0 : options.port) !== null && _c !== void 0 ? _c : parseInt((_d = process.env.HTTP_PORT) !== null && _d !== void 0 ? _d : '80');
14
15
  this.registeredPaths = new Map();
15
16
  this.server = http.createServer((req, res) => {
16
17
  var _a, _b;
@@ -66,7 +67,7 @@ class HttpServer extends EventEmitter {
66
67
  this.server.on('error', (err) => {
67
68
  this.emit('error', err);
68
69
  });
69
- this.server.listen(this.port);
70
+ this.server.listen(this.port, this.host);
70
71
  this.sockets = {};
71
72
  let idTracker = 0;
72
73
  this.server.on('connection', (socket) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "dependencies": {