-
Notifications
You must be signed in to change notification settings - Fork 0
Performance
faustyn-p edited this page Aug 30, 2020
·
1 revision
If you want to terminate the service, please use destroy
function. It will close all devices sockets, as well as main service socket itself.
yeelightService.destroy();
You can close connection of single device, by using destroy
function on device. Example:
yeelightService.devices.subscribe((devices) => {
devices.forEach(() => {
const deviceName = device.name.value;
const deviceConnected = device.connected.value;
if (!deviceConnected) {
return;
}
if (deviceName !== 'myDevice') {
device.destroy();
}
// do something with device `myDevice` knowing, that every other device is disconnected from socket
});
});