Unfortunately, no platforms I'm aware of have well-defined behaviour
nor documented APIs to handle the case when the maximum number of
connections is reached. It seems people working on Bluetooth stacks
have not really thought, cared about or even tested what will or
should happen if users have many BLE devices. As an example, the
Bluetooth stack in Android hangs if you have 7 BLE connections and try
to establish the 8th with "autoConnect=true" (in the way that it will
never again connect to BLE devices until Bluetooth is restarted, even
if the 7 get disconnected). If you have GATT notifications you listen
to in Windows and are above the maximum number of connections, you get
no event telling this, so some notifications will not be delivered to
your computer (since the peripheral can't connect). Generally among
most platforms some random error code is thrown (general failure,
internal error, unspecified error, gatt error) when you actively try
to connect a new device when the maximum number of connections has
been reached. Sometimes a better error code like "no resources" is
thrown. The non-existing documentation of error codes that is
unfortunately general among all BLE implementations is very annoying
when you are an app developer (Windows must be the worst when they're
trying to map BLE errors to their general 0x80... HRESULT error
codes).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Here's what we know from Emil:
Source: https://github.com/WebBluetoothCG/web-bluetooth/issues/342#issuecomment-268117085