homey-api 3.4.2 → 3.4.3
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.
|
@@ -639,14 +639,6 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
639
639
|
}
|
|
640
640
|
|
|
641
641
|
async connect({
|
|
642
|
-
onDisconnect = () => {},
|
|
643
|
-
onError = () => {},
|
|
644
|
-
onReconnect = () => {},
|
|
645
|
-
onReconnectAttempt = () => {},
|
|
646
|
-
onReconnecting = () => {},
|
|
647
|
-
onReconnectError = () => {},
|
|
648
|
-
onConnect = () => {},
|
|
649
|
-
onConnectError = () => {},
|
|
650
642
|
reconnect = true
|
|
651
643
|
} = {}) {
|
|
652
644
|
if (!this.__connectPromise) {
|
|
@@ -672,43 +664,43 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
672
664
|
|
|
673
665
|
this.__socket.on('disconnect', reason => {
|
|
674
666
|
this.__debug('SocketIOClient.onDisconnect', reason);
|
|
675
|
-
|
|
667
|
+
this.emit('disconnect', reason);
|
|
676
668
|
});
|
|
677
669
|
|
|
678
670
|
this.__socket.on('error', err => {
|
|
679
671
|
this.__debug('SocketIOClient.onError', err.message);
|
|
680
|
-
|
|
672
|
+
this.emit('error', err);
|
|
681
673
|
});
|
|
682
674
|
|
|
683
675
|
this.__socket.on('reconnect', () => {
|
|
684
676
|
this.__debug('SocketIOClient.onReconnect');
|
|
685
|
-
|
|
677
|
+
this.emit('reconnect');
|
|
686
678
|
});
|
|
687
679
|
|
|
688
680
|
this.__socket.on('reconnect_attempt', () => {
|
|
689
681
|
this.__debug(`SocketIOClient.onReconnectAttempt`);
|
|
690
|
-
|
|
682
|
+
this.emit('reconnect_attempt');
|
|
691
683
|
});
|
|
692
684
|
|
|
693
685
|
this.__socket.on('reconnecting', attempt => {
|
|
694
686
|
this.__debug(`SocketIOClient.onReconnecting (Attempt #${attempt})`);
|
|
695
|
-
|
|
687
|
+
this.emit('reconnecting');
|
|
696
688
|
});
|
|
697
689
|
|
|
698
690
|
this.__socket.on('reconnect_error', err => {
|
|
699
691
|
this.__debug('SocketIOClient.onReconnectError', err.message, err);
|
|
700
|
-
|
|
692
|
+
this.emit('reconnect_error');
|
|
701
693
|
});
|
|
702
694
|
|
|
703
695
|
this.__socket.on('connect_error', err => {
|
|
704
696
|
this.__debug('SocketIOClient.onConnectError', err.message);
|
|
705
|
-
|
|
697
|
+
this.emit('connect_error');
|
|
706
698
|
reject(err);
|
|
707
699
|
});
|
|
708
700
|
|
|
709
701
|
this.__socket.on('connect', () => {
|
|
710
702
|
this.__debug('SocketIOClient.onConnect');
|
|
711
|
-
|
|
703
|
+
this.emit('connect');
|
|
712
704
|
this.__handshakeClient()
|
|
713
705
|
.then(() => {
|
|
714
706
|
this.__debug('SocketIOClient.onConnect.onHandshakeClientSuccess');
|
|
@@ -766,6 +758,8 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
766
758
|
this.__socket.close();
|
|
767
759
|
this.__socket = null;
|
|
768
760
|
}
|
|
761
|
+
|
|
762
|
+
this.removeAllListeners();
|
|
769
763
|
}
|
|
770
764
|
|
|
771
765
|
async __handshakeClient() {
|