Re: [web-bluetooth] API which provides the negotiated MTU is required (#383)

There are a bunch of applications where the specifications assume the MTU is known.
For my case I'd like to implement Flic 2: https://github.com/50ButtonsEach/flic2-documentation/wiki/Flic-2-Protocol-Specification, where the fragmentation/segmentation can be much more efficient if the MTU is known (especially if LE Data Length extension is supported). Otherwise one have to be on the safe side and assume 23.

On Mac, Windows and BlueZ, the MTU is hardcoded and always negotiated by the system when a connection starts before GATT is activated for the user. On Android it's customizable but there's as far as I know no reason not to try setting it to 517 (maximum supported).

However, now when you mention it, the remote device may select a lower MTU than requested, and I'm not sure if that value can be retrieved from all platforms. :/
Mac: https://developer.apple.com/documentation/corebluetooth/cbperipheral/1620312-maximumwritevaluelength
Android: onMtuChanged
BlueZ: ?
Windows: Maybe https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.genericattributeprofile.gattsession.maxpdusize#Windows_Devices_Bluetooth_GenericAttributeProfile_GattSession_MaxPduSize can be used?

-- 
GitHub Notification of comment by Emill
Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/issues/383#issuecomment-583552176 using your GitHub account

Received on Friday, 7 February 2020 18:51:28 UTC