v130 · device
Web Serial: connected attribute and RFCOMM connection events
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. Pr
concepts
-
SerialPort probe
Probes the SerialPort interface for the new
connectedattribute and registersconnect/disconnectlisteners against a real port fromnavigator.serial.requestPort(). -
Reconnect policy decision tree
The chromestatus motivation by name: re-open after range loss, but NOT after a user-initiated disconnect. Six real-world scenarios (range loss, system disconnect, battery die, cable unplug, permission revoke, page reload) each with the correct policy under the new event model.
-
State-machine debugger
Drive a real granted serial port through permission, open, reader-lock, and close states. The event ticker records browser
connect/disconnectevents with the currentport.connectedvalue. -
RFCOMM Device Explorer
List real granted serial ports, inspect
SerialPort.connected, and watch liveconnect/disconnectevents fromnavigator.serial.
why it shipped
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.