isy-nodejs 1.0.3-alpha.0 → 1.0.3-alpha.2
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/dist/esm/ISY.js +7 -2
- package/dist/esm/ISY.js.map +1 -1
- package/dist/esm/types/ISY.d.ts.map +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/ISY.ts +9 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "isy-nodejs",
|
|
3
3
|
"description": "Node.js wrapper for ISY interface including websockets for change notifications. Fork of isy-js by Rod Toll. Designed to be used in a node.js application.",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.0.3-alpha.
|
|
5
|
+
"version": "1.0.3-alpha.2",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Pradeep Mouli"
|
|
8
8
|
},
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "c3ed60b8ba0978f8bcfa67a50d4d863c962f7268"
|
|
77
77
|
}
|
package/src/ISY.ts
CHANGED
|
@@ -180,6 +180,7 @@ export class ISY extends EventEmitter implements Disposable {
|
|
|
180
180
|
this.webSocketOptions = { origin: 'com.universal-devices.websockets.isy' };
|
|
181
181
|
|
|
182
182
|
if (this.socketPath) {
|
|
183
|
+
|
|
183
184
|
this.webSocketOptions.socketPath = this.socketPath;
|
|
184
185
|
} else {
|
|
185
186
|
this.webSocketOptions.auth = `${this.credentials.username}:${this.credentials.password}`;
|
|
@@ -401,7 +402,13 @@ export class ISY extends EventEmitter implements Disposable {
|
|
|
401
402
|
const that = this;
|
|
402
403
|
|
|
403
404
|
//const auth = `Basic ${Buffer.from(`${this.credentials.username}:${this.credentials.password}`).toString('base64')}`;
|
|
404
|
-
|
|
405
|
+
let address = `${this.wsprotocol}://${this.address}/rest/subscribe`
|
|
406
|
+
if(this.socketPath)
|
|
407
|
+
{
|
|
408
|
+
address = `ws+unix://${this.socketPath}/rest/subscribe`;
|
|
409
|
+
}
|
|
410
|
+
this.logger.info(`Opening webSocket: ${address}`);
|
|
411
|
+
this.logger.info('Using the following websocket options: ' + JSON.stringify(this.webSocketOptions));
|
|
405
412
|
if (this.webSocket) {
|
|
406
413
|
try {
|
|
407
414
|
this.webSocket.close();
|
|
@@ -418,7 +425,7 @@ export class ISY extends EventEmitter implements Disposable {
|
|
|
418
425
|
ping: 10*/
|
|
419
426
|
let p = new Promise<void>((resolve, reject) => {
|
|
420
427
|
|
|
421
|
-
this.webSocket = new WebSocket(`${
|
|
428
|
+
this.webSocket = new WebSocket(`${address}`, ['ISYSUB'], this.webSocketOptions);
|
|
422
429
|
this.lastActivity = new Date();
|
|
423
430
|
//this.webSocket.onmessage = (event) => {this.handleWebSocketMessage()
|
|
424
431
|
this.webSocket.on('open',() => {
|