openspeedtest / Speed-Test

SpeedTest by OpenSpeedTestâ„¢ is a Free and Open-Source HTML5 Network Performance Estimation Tool Written in Vanilla Javascript and only uses built-in Web APIs like XMLHttpRequest (XHR), HTML, CSS, JS, & SVG. No Third-Party frameworks or libraries are Required. Started in 2011 and moved to OpenSpeedTest.com dedicated Project/Domain Name in 2013.
https://openspeedtest.com
MIT License
2.28k stars 221 forks source link

saveDataURL / saveData - what type of backend is expected #93

Open falz opened 1 year ago

falz commented 1 year ago

In the config elemnts there's references to 'saving data' from a result:

var saveDataURL = "//yourDatabase.Server.com:4500/save?data=

Is this implemented, and if so what type of 'database' is it looking to send to on port 4500? per /etc/services this seems to not be a standard port for a known database server.

falz commented 1 year ago

Note I did find this issue: https://github.com/openspeedtest/Speed-Test/issues/10 which talks about a SQL database, but I see no code in the github page related to SQL, authentication, or any other 'usual' things one would expect when connecting to a SQL db.

openspeedtest commented 1 year ago

Yes, Script will make a POST request with some parameters and values. You need to handle the request at the server side (you need to write your own code at server side). We do not have official support for this feature yet.

falz commented 1 year ago

Thank you - do you have a sample of how this POST request is formatted?

I set saveDataURL to a FQDN and saveData = true and sniffed port 4500 (default) to see the format but I did not receive any results.

I also tried port 80 to see if it put a log entry in my httpd logs, but it did not.

clues to see what it's doing? Looking to see what data is sent to determine if I want to add a simple script to capture results.

Thanks!

openspeedtest commented 1 year ago

Enable it and look at the browser console to view the POST request. 4500 is just an example. You need to replace the URL with your own database handling URL, for example, yourdomain.com/savedata.php.

falz commented 1 year ago

I did also look in 'inspect' console but do not see it. per above I did set saveDataURL to a few different things to test, but no results. saveData = true - anything more than those two options?

Console screenshot, the last red error occurs (and continues to loop?) after test is complete. 'Developed by' shows up when one hits start.

Screenshot from 2023-08-30 10-57-40

Looks like the line refers to OpenSpeedTestdb perhaps it should instead be saveDataURL?

openspeedtest commented 1 year ago

Declare a variable named OpenSpeedTestdb and initialize it to 0. This is not related to this topic, but it is a known issue that I will fix very soon.

falz commented 1 year ago

Is the saveDataURL supposed to start with http:// or similar? the example starts with // which is weird.

openspeedtest commented 1 year ago

// This will match the protocol http or https used by the browser. You can also specify https://