Is it possible to persist a Bluetooth LE connection on browser refresh

狂风中的少年 提交于 2019-12-24 19:38:39

问题


Is it possible to persist a Bluetooth LE connection on browser refresh? Or at least minimize the pairing time?


回答1:


Eventually navigator.permissions.query would support this. Sample code from Web Bluetooth Specification

navigator.permissions.query({
  name: "bluetooth",
  deviceId: sessionStorage.lastDevice,
}).then(result => {
  if (result.devices.length == 1) {
    return result.devices[0];
  } else {
    throw new DOMException("Lost permission", "NotFoundError");
  }
}).then(...);

However, no browser currently implements this.

As of Q3 2017 the chromium implementation is actively working on Web Bluetooth but not this feature.



来源:https://stackoverflow.com/questions/45467214/is-it-possible-to-persist-a-bluetooth-le-connection-on-browser-refresh

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!