karelkryda / universal-speedtest

The Universal Speedtest library allows you to measure the speed of your internet connection using Ookla speedtest.
https://www.npmjs.com/package/universal-speedtest
GNU General Public License v3.0
15 stars 5 forks source link

Can this package be run in the browser? #23

Open rivasaugusto opened 2 years ago

rivasaugusto commented 2 years ago

Can this package be run in the browser, say as part of a React web application? I've been looking at similar speed tests package and I'm seeing the owners saying that their packages are not meant to be run in the browser. Just wanted to confirm that with this package. I haven't been able to install this package successfully in my React project, so I guess this may be why.

PS: I'm just looking for a way to determine the user's internet speed once they're navigating through my web app, and alert them if they have a slow connection. I know how to estimate this by using the "image approach", but wanted to see if any package already serves this purpose. Thanks.

karelkryda commented 1 year ago

Hi, I'm honestly not sure. There may be problems (using perf_hooks) due to the time tracking code used. It will be easiest to test this fact. In case there are any problems due to perf_hooks, I am currently working on version 3.0.0, which should solve this. Thank you for your understanding

karelkryda commented 1 month ago

Hello @rivasaugusto, I just released the release candidate of version 3.0.0. You can install and test the library using:

npm install --save universal-speedtest@next

The new documentation can be found here: https://karel-kryda.gitbook.io/universal-speedtest/v/3

I hope that if the current version was not compatible with the browser run, the new version will be. If you would test it and get back to me with the result, I would be happy.

I hope everything will work as expected 😉. Thank you in advance