Which Web Bluetooth operations should not be done in parallel

1,379 views
Skip to first unread message

François Beaufort 🇫🇷

unread,
Oct 18, 2016, 10:30:30 AM10/18/16
to web-bluetooth
I'd like to provide guidance on which Web Bluetooth operations should not be done in parallel.
Ideally, I'd like all of them to be able to work in parallel but some can't right now IIRC.
Here are the ones I think would work for now:

GATT Server Disconnect
getPrimaryService*()
getIncludedService*()
getCharacteristic*()

And the ones we can't use with Promise.all for instance:

GATT Server Connect
Read Characteristic
Write Characteristic
Start GATT Notifications
Stop GATT Notifications

Can you confirm/rectify?

Thank you,
Francois

Joe Medley

unread,
Oct 18, 2016, 10:51:28 AM10/18/16
to François Beaufort 🇫🇷, web-bluetooth
Francois,

It sounds like this is a temporary problem and should NOT be incorporated into permanent documentation.

Can you please confirm?

Joe

Joe Medley | Technical Writer, Chrome DevRel | jme...@google.com | 816-678-7195
If an API's not documented it doesn't exist.

--
You received this message because you are subscribed to the Google Groups "web-bluetooth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetooth+unsubscribe@chromium.org.
To post to this group, send email to web-bl...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/web-bluetooth/CAPpwU5LBDuzbh3He94rPqNB9uP-5qkY_gv%2BOCkjt7jWjKHugmA%40mail.gmail.com.

François Beaufort 🇫🇷

unread,
Oct 18, 2016, 11:32:26 AM10/18/16
to Joe Medley, web-bluetooth
I'm not sure if it is a temporary problem or not actually.

For info, I am testing these operations with https://beaufortfrancois.github.io/sandbox/web-bluetooth/promise-all/ and I'll share my findings when I can test on all platforms. 

To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetoot...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "web-bluetooth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetoot...@chromium.org.

To post to this group, send email to web-bl...@chromium.org.

Jeffrey Yasskin

unread,
Oct 18, 2016, 5:00:48 PM10/18/16
to François Beaufort 🇫🇷, web-bluetooth
We have a discussion about this at https://github.com/WebBluetoothCG/web-bluetooth/issues/188. We don't yet have consensus about whether the implementation should take steps to serialize anything that needs to be serialized, or whether websites should do it. For now, Chrome doesn't, so anything Android can return InProgress for, we can too. You probably have the right set.

This is something that should make it into the spec, but I'm not going to have time before I disappear for parental leave. If someone else wants to edit it in, go ahead.

We should probably say something like this on public-web-bluetooth too.

On Tue, Oct 18, 2016 at 7:30 AM, 'François Beaufort 🇫🇷' via web-bluetooth <web-bl...@chromium.org> wrote:

--
You received this message because you are subscribed to the Google Groups "web-bluetooth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetooth+unsubscribe@chromium.org.

Giovanni Ortuño

unread,
Oct 18, 2016, 6:16:58 PM10/18/16
to Jeffrey Yasskin, François Beaufort 🇫🇷, web-bluetooth
I think it's just Connect, Read, and Write. We recently added queuing for notifications.

On Wed, Oct 19, 2016 at 8:00 AM Jeffrey Yasskin <jyas...@chromium.org> wrote:
We have a discussion about this at https://github.com/WebBluetoothCG/web-bluetooth/issues/188. We don't yet have consensus about whether the implementation should take steps to serialize anything that needs to be serialized, or whether websites should do it. For now, Chrome doesn't, so anything Android can return InProgress for, we can too. You probably have the right set.

This is something that should make it into the spec, but I'm not going to have time before I disappear for parental leave. If someone else wants to edit it in, go ahead.

We should probably say something like this on public-web-bluetooth too.

On Tue, Oct 18, 2016 at 7:30 AM, 'François Beaufort 🇫🇷' via web-bluetooth <web-bl...@chromium.org> wrote:
I'd like to provide guidance on which Web Bluetooth operations should not be done in parallel.
Ideally, I'd like all of them to be able to work in parallel but some can't right now IIRC.
Here are the ones I think would work for now:

GATT Server Disconnect
getPrimaryService*()
getIncludedService*()
getCharacteristic*()

And the ones we can't use with Promise.all for instance:

GATT Server Connect
Read Characteristic
Write Characteristic
Start GATT Notifications
Stop GATT Notifications

Can you confirm/rectify?

Thank you,
Francois

--
You received this message because you are subscribed to the Google Groups "web-bluetooth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetoot...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "web-bluetooth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetoot...@chromium.org.

To post to this group, send email to web-bl...@chromium.org.

François Beaufort 🇫🇷

unread,
Oct 19, 2016, 3:57:02 AM10/19/16
to Giovanni Ortuño, Jeffrey Yasskin, web-bluetooth
Here are not supported parallel operations and their respective errors I've found on Dev Channel (55.0.2883.17):

Android: 
readValue - DOMException: GATT operation failed for unknown reason.
writeValue - DOMException: GATT operation already in progress.

Chrome OS / Linux:
connect - DOMException: Connection failed for unknown reason.
readValue - DOMException: GATT Error Unknown.
writeValue - DOMException: GATT operation already in progress.

Mac OS:
readValue - DOMException: GATT Error: Not supported.
writeValue - DOMException: GATT operation already in progress.
stopNotifications is not implemented yet.

As you can see, parallel connects works fine on Android while they're not on other platforms.
readValue error message is not consistent across platforms.
stopNotifications is not implemented yet on Mac OS but I suspect it should work fine eventually.

If some are unexpected, we should definitely file bugs.

François Beaufort 🇫🇷

unread,
Oct 19, 2016, 3:58:58 AM10/19/16
to Giovanni Ortuño, Jeffrey Yasskin, web-bluetooth
Nit: As you can see, parallel connects works fine on Android and Mac OS while they're not on other platforms.

Jeffrey Yasskin

unread,
Oct 19, 2016, 12:43:55 PM10/19/16
to François Beaufort 🇫🇷, Giovanni Ortuño, Jeffrey Yasskin, web-bluetooth
Thank you for testing this! Would you update https://github.com/WebBluetoothCG/web-bluetooth/issues/188 with that as the current implementation state? I'll try to get it into the spec before I disappear.

To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetooth+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "web-bluetooth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetooth+unsubscribe@chromium.org.

To post to this group, send email to web-bl...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "web-bluetooth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetooth+unsubscribe@chromium.org.

Vincent Scheib

unread,
Oct 19, 2016, 5:36:04 PM10/19/16
to Jeffrey Yasskin, François Beaufort 🇫🇷, Giovanni Ortuño, web-bluetooth
+1 update the issue as FYI, I'm not sure that it drives to a consensus for what to do. 

jyasskin what are you intending to get into the spec?

Jeffrey Yasskin

unread,
Oct 19, 2016, 6:02:05 PM10/19/16
to Vincent Scheib, Jeffrey Yasskin, François Beaufort 🇫🇷, Giovanni Ortuño, web-bluetooth
I'd like to say that these operations may return a NetworkError if the UA/platform is currently using the device in any way. I'm not certain that NetworkError is the right error, but it's what we use: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/bluetooth/BluetoothError.cpp?l=68-69.

Vincent Scheib

unread,
Oct 19, 2016, 8:18:43 PM10/19/16
to Jeffrey Yasskin, François Beaufort 🇫🇷, Giovanni Ortuño, web-bluetooth
Thanks, SGTM

François Beaufort 🇫🇷

unread,
Oct 20, 2016, 10:27:30 AM10/20/16
to Vincent Scheib, Jeffrey Yasskin, Giovanni Ortuño, web-bluetooth

Thanks, SGTM

To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetoot...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "web-bluetooth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetoot...@chromium.org.

To post to this group, send email to web-bl...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "web-bluetooth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetoot...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "web-bluetooth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetoot...@chromium.org.

To post to this group, send email to web-bl...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "web-bluetooth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-bluetoot...@chromium.org.

To post to this group, send email to web-bl...@chromium.org.
Reply all
Reply to author
Forward
0 new messages