W3C home > Mailing lists > Public > public-web-bluetooth-log@w3.org > June 2016

[web-bluetooth] How to add disconnect event handler

From: Juergen Kienhoefer via GitHub <sysbot+gh@w3.org>
Date: Tue, 14 Jun 2016 18:51:51 +0000
To: public-web-bluetooth-log@w3.org
Message-ID: <issues.opened-160256541-1465930310-sysbot+gh@w3.org>
aircable has just created a new issue for 
https://github.com/WebBluetoothCG/web-bluetooth:

== How to add disconnect event handler ==
I would like to get a disconnect event from the gatt server.

            navigator.bluetooth.requestDevice(options)
                .then(function ( device ) {
                    console.log('Name: ' + device.name);
                    server.addEventListener( 'gattserverdisconnected',
 handleDisconnect );
                    return device.gatt.connect();
                })
                .then(function ( server ) {
                    console.log('server ' + server );
                    return server.getPrimaryService( MESH_SERVICE_UUID
 );
                })

The event listener add is accepted, but never executed. The 
BluetoothRemoteGATTServer object does not have a addEventListener 
function.
Am I doing something wrong? This is on Android Chrome 51.0.2704.81
Thanks

Please view or discuss this issue at 
https://github.com/WebBluetoothCG/web-bluetooth/issues/244 using your 
GitHub account
Received on Tuesday, 14 June 2016 18:51:52 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 14 June 2016 18:51:53 UTC