
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
react-web-bluetooth
Advanced tools
This is a package that provides a hooks wrapper around the new Web Bluetooth API
It is an experimental feature implemented under a flag in Chrome. In order to use this feature in Chrome, enable:
chrome://flags/#enable-experimental-web-platform-features
The getDevices
method requires also to enable the new permissions backend experimental feature.
chrome://flags/#enable-web-bluetooth-new-permissions-backend
getDevices
is used to retrieve already paired Bluetooth devices from the browser, for example after a refresh instead of pairing a device again getDevices
can be used to connect to it without pairing.
const { onClick, device } = useRequestDevice({
acceptAllDevices: true,
});
// ...
return <>
{!device && <button onClick={onClick}>Connect</button>}
{device && <span>{device.name}</span>}
</>
useGetServer
Params:
device
: BluetoothDevice
Returns:
server
: BluetoothRemoteGATTServer
useGetCharacteristic
Params:
service
: BluetoothRemoteGATTService
bluetoothCharacteristicUUID
: string
Returns:
characteristic
: BluetoothRemoteGATTCharacteristic
useGetDevices
Returns: devices[]
: BluetoothDevice[]
useRequestDevice
Params:
options
: https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/requestDevice#parameters
Returns:
onClick
: (event) => void // returns a onClick function that can be used to trigget the browser's pairing window and list the scanned Bluetooth devices.
device
: BluetoothDevice // returns a device chosen from the Bluetooth pairing dialogue.
useGetPrimaryService
Params:
device
: BluetoothDevice
Returns:
service
: BluetoothRemoteGATTService
useReadValue
Params:
characteristic
: BluetoothRemoteGATTCharacteristic
Returns::
value
: DataView
writeValue
Params:
characteristic
: BluetoothRemoteGATTCharacteristic
value
: ArrayBuffer
FAQs
React hooks wrapper for the Web Bluetooth API
We found that react-web-bluetooth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.