{"action":"created","issue":{"url":"https://api.github.com/repos/WebBluetoothCG/web-bluetooth/issues/215","repository_url":"https://api.github.com/repos/WebBluetoothCG/web-bluetooth","labels_url":"https://api.github.com/repos/WebBluetoothCG/web-bluetooth/issues/215/labels{/name}","comments_url":"https://api.github.com/repos/WebBluetoothCG/web-bluetooth/issues/215/comments","events_url":"https://api.github.com/repos/WebBluetoothCG/web-bluetooth/issues/215/events","html_url":"https://github.com/WebBluetoothCG/web-bluetooth/issues/215","id":136155982,"number":215,"title":"Consider an event when a device is physically disconnected","user":{"login":"jyasskin","id":83420,"avatar_url":"https://avatars.githubusercontent.com/u/83420?v=3","gravatar_id":"","url":"https://api.github.com/users/jyasskin","html_url":"https://github.com/jyasskin","followers_url":"https://api.github.com/users/jyasskin/followers","following_url":"https://api.github.com/users/jyasskin/following{/other_user}","gists_url":"https://api.github.com/users/jyasskin/gists{/gist_id}","starred_url":"https://api.github.com/users/jyasskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jyasskin/subscriptions","organizations_url":"https://api.github.com/users/jyasskin/orgs","repos_url":"https://api.github.com/users/jyasskin/repos","events_url":"https://api.github.com/users/jyasskin/events{/privacy}","received_events_url":"https://api.github.com/users/jyasskin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-02-24T19:05:14Z","updated_at":"2016-02-25T16:16:51Z","closed_at":null,"body":"Calling [`BluetoothRemoteGATTServer.disconnect()`](https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-disconnect) disconnects the current Realm and allows the UA to physically disconnect if no other Realm is connected. [`gattserverdisconnected`](https://webbluetoothcg.github.io/web-bluetooth/#eventdef-bluetoothdevice-gattserverdisconnected) in turn reports if the current Realm was disconnected without asking to be, but this doesn't say whether the device was [revoked](https://github.com/WebBluetoothCG/web-bluetooth/pull/210) or the physical connection was lost (and I think we want to preserve that ambiguity).\r\n\r\n@beaufortfrancois reports that some devices treat physical disconnection as a semantic actions, and change their state in response, and web pages want to convey that to the user. Is that beyond the BT4.0 behavior that peripherals can have only one physical connection?\r\n\r\nWe could add a `.physicallyConnected` attribute to the `gattserverdisconnected` event, and use that to distinguish Realm vs UA disconnections (treating the UA as including its OS/platform here). I don't think we want to let a Realm force the UA to disconnect, since that can interfere with other Realms, but the information leak from telling a Realm whether other Realms are connected seems small enough to accept.\r\n\r\nThoughts?"},"comment":{"url":"https://api.github.com/repos/WebBluetoothCG/web-bluetooth/issues/comments/188859781","html_url":"https://github.com/WebBluetoothCG/web-bluetooth/issues/215#issuecomment-188859781","issue_url":"https://api.github.com/repos/WebBluetoothCG/web-bluetooth/issues/215","id":188859781,"user":{"login":"thegecko","id":61341,"avatar_url":"https://avatars.githubusercontent.com/u/61341?v=3","gravatar_id":"","url":"https://api.github.com/users/thegecko","html_url":"https://github.com/thegecko","followers_url":"https://api.github.com/users/thegecko/followers","following_url":"https://api.github.com/users/thegecko/following{/other_user}","gists_url":"https://api.github.com/users/thegecko/gists{/gist_id}","starred_url":"https://api.github.com/users/thegecko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thegecko/subscriptions","organizations_url":"https://api.github.com/users/thegecko/orgs","repos_url":"https://api.github.com/users/thegecko/repos","events_url":"https://api.github.com/users/thegecko/events{/privacy}","received_events_url":"https://api.github.com/users/thegecko/received_events","type":"User","site_admin":false},"created_at":"2016-02-25T16:16:51Z","updated_at":"2016-02-25T16:16:51Z","body":"IMO this event _should_ fire when the Realm calls ```.disconnect()```. It offers a single place to do any clean up / reconnection no matter the cause of the disconnect."}}