Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the MTU #263

Open
maelp opened this issue Oct 17, 2024 · 5 comments
Open

Get the MTU #263

maelp opened this issue Oct 17, 2024 · 5 comments

Comments

@maelp
Copy link

maelp commented Oct 17, 2024

Is there a way to get the peripheral MTU?

@thegecko
Copy link
Owner

Since switching to SimpleBLE, we are reliant on what that exposes, so that needs cheking.

I'm not sure where we would expose it, I can't see the Webbluetooth specification mentions exposing it

@maelp
Copy link
Author

maelp commented Oct 20, 2024

Hmmm... but if you don't expose MTU, how do I know how many bytes can fit in a packet?

@thegecko
Copy link
Owner

@maelp
Copy link
Author

maelp commented Oct 20, 2024

BTW when using your library in a browser environment, does your library automatically switch to the underlying Webbluetooth backend? Or does the user have to do something like

const ble = env.NODE ? import "webbluetooth" : new window.WebBluetooth()

or equivalent? And would that be complicated to implement other third-party backends (I'm thinking about https://github.com/capacitor-community/bluetooth-le)

(if this was done "transparently" it would allow me to use your lib in a third-party lib that could be used both in Node and in the browser, and in a Capacitor iOS / Android app, which would be really convenient)

@thegecko
Copy link
Owner

This library requires native modules, so would never work in a browser. Ideally you should be creating different builds for web and desktop and depending on your packaging environment you should be able to trivially swap this in when building on desktop. It aims to follow the webbluetooth spec so the API is the same as the native web one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants