Latency question

60 views
Skip to first unread message

Boom Shacka

unread,
Dec 27, 2019, 9:29:16 PM12/27/19
to WebUSB
I would like to use this API to stream byte data over to a USB device, with the message sent from javascript running in a web browser.

The problem is, I need the latency to be really low, preferably under 2 milliseconds.

I tried a different solution, just sending a regular XMLHttpRequest via javascript to a server running on localhost (and then the local server could then easily interact with the USB using some native API), and the latency was about 20 milliseconds, but that won't work for my application.

I haven't tried websockets yet (or some other solution if one exists?), but I'm concerned the latency there might be too high as well, from what I've read it's not that great of a performance improvement (though I could be wrong)

If I use this library to try to send data to a USB device via javascript, what would the latency be? How long could I expect the data to reach the USB after sending the command in javascript?

Or if there is anyway at all to send a message from javascript to some running process on the desktop with a latency under 2 milliseconds, that would really help.

Any help appreciated, thanks

Reilly Grant

unread,
Jan 2, 2020, 2:05:16 PM1/2/20
to Boom Shacka, WebUSB
Using WebUSB should be the lowest-latency option for sending commands via Javascript.

It would help if you could tell me a little more about what your application is and what kinds of performance constraints you have. There are potential optimizations that could be made to the WebUSB implementation but they would primarily improve streaming data to bulk endpoints rather than the latency of individual requests.
Reilly Grant | Software Engineer | rei...@chromium.org | Google Chrome


--
You received this message because you are subscribed to the Google Groups "WebUSB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webusb+un...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/webusb/a8074909-7282-4d69-b4d9-73494fd219ef%40chromium.org.
Reply all
Reply to author
Forward
0 new messages