Closed vicary closed 6 years ago
Do not require bleno twice, even from another process. In my case crond and a daemonized process.
This package initiates hardware upon reuqire("bleno")
where I use lockfile and daemonized processes to keep it running. Whenever another process starts by crond and checks for lockfile, by best practise we require
everything at the top of the script it kind of "takes over" the hardware handle, or more accurately, the HCI binding and re-initiates it with defaults and stops the advertisement.
The behavior of this package, and I've seen others alike, conflicts with an established common-practise in the community, aka hoisting require
.
This is a follow up of #382, opening a new issue since it is closed prematurely and I am not getting replies. I am copying the context here.
The Issue
I am testing Bleno with Noble in a Raspberry Pi with Raspbian Lite.
After I called
bleno.startAdvertising(...);
I can scan the device with an iPhone and an Android, but when I refresh the device list after initial discovery the Pi never appeared again until I reboot.Update 1 https://github.com/noble/bleno/issues/382#issuecomment-388281714
Update 2 https://github.com/noble/bleno/issues/382#issuecomment-388296035