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
What are the differences between WebHID and Web Serial API? #4824
Comments
@beaufortfrancois can you answer this? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. To prevent this from happening, leave a comment. |
Closing this issue because it has been marked as stale for more than 7 days. |
Sorry for the delay @kiwenlau, hopefully https://web.dev/devices-introduction/ will give you some hints. |
The difference between the Web Serial API and the WebHID API is that one allows you to use devices that are available through the operating system's serial API and the other through the operating system's HID API.
If you are trying to communicate with a particular device then it is probably available through only one of these options (or maybe it is a generic USB device, in which case WebUSB is the right option). If you are designing your own device then you get to choose how it presents itself to the operating system and so you can choose which API you will have to use. In that case the decision should be based on whether the properties of serial, HID or raw USB communication fit your use case better.
Right now the APIs operate independently. That means that if you are communicating with a physical device that provides serial and HID interfaces you will have to request permission to use the device through each API independently. This is an area where we have considered API and UX changes to make it easier to deal with such hybrid devices. |
@kiwenlau please let us know if https://web.dev/devices-introduction/ answers your question. Gonna close this for now but we can re-open if needed. |
It seems that both WebHID and Web Serial API are used for communicating with hardware.
The text was updated successfully, but these errors were encountered: