[feature request] Network connectivity checker
-
Currently we can use
Server.isOnline()to see if there is an internet connection. This works by pinging google's server and seeing if it gets a result. It's a basic solution to the problem but not ideal. For example I've had users in China behind the great firewall who are able to connect to my server but not Google's. I've also had other users who have a slow connection and have to wait quite a while for the check to return, and in the meantime it looks like my plugin's just hanging or frozen.A better solution is to ask the OS if there is currently an active network connection.
After googling the problem it seems another JUCE user has already come up with a way to do it.
@Christoph-Hart If you think this is good and when you have time, could you implement it, and perhaps add a broadcaster too?
Additionally this also tells us the type of connection the system is using. This is nice because we can give the user the option of only downloading large files when not using mobile data for example.
-
Claude implementation: https://github.com/christophhart/HISE/pull/953
Tested on Linux so far.
-
@David-Healey Hey Dave! I currently have a user enable to get the online mode on my license manager...
So I'm checking this solution but it seems I couldn't build for some reasons (macOS)
Claude helped:
What was wrong: NetworkConnectivityCheckerApple.cpp includes <SystemConfiguration/SystemConfiguration.h>, which transitively pulls in MacTypes.h. That Carbon-era header defines a global Point struct, which is ambiguous against juce::Point (brought into scope by the using namespace juce; directive in the unity translation unit).
Fix: Wrap the SystemConfiguration include with #define Point DummyPoint (plus Component and MemoryBlock) and matching #undefs, mirroring the existing trick at hi_tools_01.cpp:36-44 for Accelerate.h. Edit at hi_tools/hi_tools/NetworkConnectivityCheckerApple.cpp:12-26.
It seems to work in Hise, I will check the exported binary today
-
@ustk I haven't tried building with it I don't think. I made the PR but haven't used it. For complicated things like this I don't trust the AI enough so I wait for Christoph to merge it.
-
@David-Healey that's a good point
But since I am having troubles anyway, I am currently releasing a new system so I'll use it and see. Since isOnline doesn't work for some people, I need a solution for them...
Do you happen to understand the issue behind isOnline?
Because I wonder if I shouldn't directly check if my own server is avail instead of google. in the end this is the only thing I need.
But perhaps the issue has a common ground no matter which website you check... And since I can't reproduce it... -
@ustk said in [feature request] Network connectivity checker:
Do you happen to understand the issue behind isOnline?
isOnline pings Google's server. On a slow connection this can time out. If the user is behind a firewall or in a country like China the request can be blocked entirely and just hang until it times out.
-
@David-Healey so there's no way my server could be faster, especially since it is actually very slow...