This feature adds a boolean SerialPort.connected attribute. The attribute is true if the serial port is logically connected. For wired serial ports, a port is logically connected if the port is physically attached to the system. For wireless serial ports, a port is logically connected if the device hosting the port has any open connections to the host. Previously, only wired serial ports dispatched connect and disconnect events. With this feature, Bluetooth RFCOMM serial ports will dispatch these events when the port becomes logically connected or disconnected. This feature is intended to allow applications to detect when a Bluetooth RFCOMM serial port is available without opening the port.
A wireless serial port opened by an application is closed when the wireless device moves out of range of the host. In this scenario, the application that opened the wireless serial port may attempt to re-open it. However, if the wireless device was disconnected intentionally (for instance, if the user disconnected the device from the system control panel) then the application should avoid re-opening the port in order to prevent reconnecting to the device. Exposing the logical connection state of the device hosting the wireless serial port enables applications to distinguish these cases and avoid reconnecting when the device was disconnected intentionally.
Explainers: https://github.com/WICG/serial/blob/main/EXPLAINER_BLUETOOTH.md