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

What are the differences between WebHID and Web Serial API? #4824

Closed
kiwenlau opened this issue Mar 8, 2021 · 6 comments
Closed

What are the differences between WebHID and Web Serial API? #4824

kiwenlau opened this issue Mar 8, 2021 · 6 comments
Assignees
Labels
content update for issues that do not require new content (only for updates to existing content)

Comments

@kiwenlau
Copy link

kiwenlau commented Mar 8, 2021

It seems that both WebHID and Web Serial API are used for communicating with hardware.

  • What are the differences between WebHID and Web Serial API?
  • When we should use WebHID or Web Serial API?
  • Are their usage scenarios exclusive or inclusive?
@robdodson
Copy link
Contributor

@beaufortfrancois can you answer this?

@kaycebasques kaycebasques added the content update for issues that do not require new content (only for updates to existing content) label Mar 10, 2021
@stale
Copy link

stale bot commented Apr 10, 2021

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.

@stale stale bot added the stale label Apr 10, 2021
@stale
Copy link

stale bot commented Apr 17, 2021

Closing this issue because it has been marked as stale for more than 7 days.

@stale stale bot closed this as completed Apr 17, 2021
@beaufortfrancois
Copy link
Member

Sorry for the delay @kiwenlau, hopefully https://web.dev/devices-introduction/ will give you some hints.
@reillyeon may have more to say though.

@stale stale bot removed the stale label Apr 20, 2021
@reillyeon
Copy link
Member

What are the differences between WebHID and Web Serial API?

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.

When we should use WebHID or Web Serial 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.

Are their usage scenarios exclusive or inclusive?

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.

@kaycebasques
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content update for issues that do not require new content (only for updates to existing content)
Projects
None yet
Development

No branches or pull requests

5 participants