BluetoothGattServer (Firefox OS)

This API is available on Firefox OS for internal applications only.

The BluetoothGattServer interface of the Web Bluetooth API provides Bluetooth GATT server functionality to allow creation of Bluetooth Smart/LE services and characteristics.

Interface overview

interface BluetoothGattServer
  [Cached, Pure] readonly attribute sequence<<a href="" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService">BluetoothGattService</a>> <a href="" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer">services</a>;

  attribute EventHandler <a href="" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer">ondeviceconnectionstatechanged</a>;
  attribute EventHandler <a href="" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer">onattributereadreq</a>;
  attribute EventHandler <a href="" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer">onattributewritereq</a>;
  [NewObject] Promise<void> <a href="" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer">connect(DOMString address)</a>;
  [NewObject] Promise<void> <a href="" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer">disconnect(DOMString address)</a>;
  [NewObject] Promise<void> <a href="" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer">addService(BluetoothGattService service)</a>;
  [NewObject] Promise<void> <a href="" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer">removeService(BluetoothGattService service)</a>;
  [NewObject] Promise<void> <a href="" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer">notifyCharacteristicChanged(DOMString address, DOMString uuid, int instanceId, bool confirm)</a>;
  [NewObject] Promise<void> <a href="" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer">sendResponse(DOMString address, int status, int requestId, ArrayBuffer value)</a>;

Properties Read only
Returns an array of the services offered by this device.

Event handlers

Defines a handler to trigger as a result of the deviceconnectionstatechanged event firing; this occurs when a remote LE device has been connected or disconnected.
Defines a handler to trigger as a result of the attributereadreq event firing; this occurs when a remote client has requested to read a server's characteristic or descriptor.
Defines a handler to trigger as a result of the attributewritereq event firing; this occurs when a remote client has requested to write a server's characteristic or descriptor.


Initiates a connection to a remote LE device.
Disconnects an already-established connection to a remote LE device.
Adds a BluetoothGattService to the server's list of provided services.
Removes a BluetoothGattService from the server's list of provided services.
Sends a notification/indication that a local characteristic has been updated.
Sends a response to a remote LE device's read or write request.


Specification Status Comment
Web Bluetooth
The definition of 'BluetoothGattServer' in that specification.
Draft Rough draft; not part of any official specification yet. It should be discussed as part of the W3C's System Applications Working Group.

Browser Compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support No support No support No support No support No support
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support No support No support 2.1 No support No support No support No support


See also

Using the Web Bluetooth API


© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.

API B2G Bluetooth BluetoothGattServer Certified Firefox OS Interface Non-standard Reference Web Bluetooth