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

Re: [web-bluetooth] Should connectGATT() time out or wait until a device is available?

From: François Beaufort via GitHub <sysbot+gh@w3.org>
Date: Thu, 16 Jun 2016 08:49:07 +0000
To: public-web-bluetooth-log@w3.org
Message-ID: <issue_comment.created-226425610-1466066945-sysbot+gh@w3.org>
Following https://bugs.chromium.org/p/chromium/issues/detail?id=620405
 discussion, it looks like `device.gatt.connect` will never reject... 
I'm not a big fan of this. I'd rather have `device.gatt.connect` to 
fail with the same amount of time on each platform and have developer 
to reconnect automatically or ask user to reconnect.

```js
function connect() {
  return device.gatt.connect()
  .then(server => ...)
  .catch(e => {
    if (e.name == 'TimeoutError') {
      // e.message = Device failed to connect after X seconds...
      // Automatically try to reconnect
      return connect();
    }
  });
}

-- 
GitHub Notification of comment by beaufortfrancois
Please view or discuss this issue at 
https://github.com/WebBluetoothCG/web-bluetooth/issues/152#issuecomment-226425610
 using your GitHub account
Received on Thursday, 16 June 2016 08:49:08 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 16 June 2016 08:49:09 UTC