homey-api 1.5.25 → 1.5.26
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.
|
@@ -416,8 +416,8 @@ class Manager extends EventEmitter {
|
|
|
416
416
|
this.__debug('onConnect');
|
|
417
417
|
this.__connected = true;
|
|
418
418
|
},
|
|
419
|
-
onDisconnect:
|
|
420
|
-
this.__debug(
|
|
419
|
+
onDisconnect: reason => {
|
|
420
|
+
this.__debug(`onDisconnect Reason:${reason}`);
|
|
421
421
|
this.__connected = false;
|
|
422
422
|
|
|
423
423
|
// Clear CRUD Item cache
|
|
@@ -505,8 +505,8 @@ class HomeyAPIV2 extends HomeyAPI {
|
|
|
505
505
|
onConnect();
|
|
506
506
|
|
|
507
507
|
// On Disconnect
|
|
508
|
-
const __onDisconnect =
|
|
509
|
-
onDisconnect();
|
|
508
|
+
const __onDisconnect = reason => {
|
|
509
|
+
onDisconnect(reason);
|
|
510
510
|
};
|
|
511
511
|
this.__io.on('disconnect', __onDisconnect);
|
|
512
512
|
|
|
@@ -550,6 +550,7 @@ class HomeyAPIV2 extends HomeyAPI {
|
|
|
550
550
|
return new Promise((resolve, reject) => {
|
|
551
551
|
this.__debug(`SocketIOClient ${baseUrl}`);
|
|
552
552
|
this.__io = SocketIOClient(baseUrl, {
|
|
553
|
+
autoConnect: false,
|
|
553
554
|
transports: ['websocket'],
|
|
554
555
|
transportOptions: {
|
|
555
556
|
pingTimeout: 8000,
|
|
@@ -607,6 +608,7 @@ class HomeyAPIV2 extends HomeyAPI {
|
|
|
607
608
|
reject(err);
|
|
608
609
|
});
|
|
609
610
|
});
|
|
611
|
+
this.__io.connect();
|
|
610
612
|
});
|
|
611
613
|
});
|
|
612
614
|
this.io.catch(err => {
|
|
@@ -667,28 +669,29 @@ class HomeyAPIV2 extends HomeyAPI {
|
|
|
667
669
|
throw err;
|
|
668
670
|
})
|
|
669
671
|
.then(({ namespace }) => {
|
|
672
|
+
this.__debug('SocketIOClient.onHandshakeClientSuccess', `Namespace: ${namespace}`);
|
|
673
|
+
|
|
670
674
|
return new Promise((resolve, reject) => {
|
|
671
|
-
this.__debug('SocketIOClient.onHandshakeClientSuccess', `Namespace: ${namespace}`);
|
|
672
675
|
this.__ioNamespace = this.__io.io.socket(namespace);
|
|
673
676
|
this.__ioNamespace.once('connect', () => {
|
|
674
|
-
this.__debug(
|
|
677
|
+
this.__debug(`SocketIOClient.Namespace[${namespace}].onConnect`);
|
|
675
678
|
resolve();
|
|
676
679
|
});
|
|
677
680
|
this.__ioNamespace.once('connect_error', err => {
|
|
678
|
-
this.__debug(
|
|
681
|
+
this.__debug(`SocketIOClient.Namespace[${namespace}].onConnectError`, err.message);
|
|
679
682
|
reject(err);
|
|
680
683
|
});
|
|
681
684
|
this.__ioNamespace.on('reconnecting', attempt => {
|
|
682
|
-
this.__debug(`SocketIOClient.Namespace.onReconnecting (Attempt #${attempt})`);
|
|
685
|
+
this.__debug(`SocketIOClient.Namespace[${namespace}].onReconnecting (Attempt #${attempt})`);
|
|
683
686
|
});
|
|
684
687
|
this.__ioNamespace.on('reconnect', () => {
|
|
685
|
-
this.__debug(
|
|
688
|
+
this.__debug(`SocketIOClient.Namespace[${namespace}].onReconnect`);
|
|
686
689
|
});
|
|
687
690
|
this.__ioNamespace.on('reconnect_error', err => {
|
|
688
|
-
this.__debug(
|
|
691
|
+
this.__debug(`SocketIOClient.Namespace[${namespace}].onReconnectError`, err.message);
|
|
689
692
|
});
|
|
690
693
|
this.__ioNamespace.on('disconnect', reason => {
|
|
691
|
-
this.__debug(
|
|
694
|
+
this.__debug(`SocketIOClient.Namespace[${namespace}].onDisconnect`, reason);
|
|
692
695
|
});
|
|
693
696
|
this.__ioNamespace.connect();
|
|
694
697
|
});
|