[I’ve edited this OP. It was initially ambiguous if I asked for a way to see if the user had a general internet connection or if the wiki had server connection]
In another thread I wondered if it is possible to tell if the wiki has access to its server.
…and, if so, could the InfoMechanism be enhanced to provide this info?
It seems reasonable that it should work; it is simple enough to try to load e.g an iframe to see if it times out. Maybe something similar could ping the server and convert the result into a state?
I assume you mean not whether it was loaded via http vs local — since that’s fairly straightforward (and doesn’t require a ping).
But if it’s not that, then it seems you want to know, in real time, whether the server is available and connected. So the question is: how often would you want this to update? And, with a service like TiddlyHost (especially given its backup history archive service), why would this be any better than having auto-save, with a clear notification of failure to save (presumably because of lack of connection to server)?
(I do think that a clearer notification of failure to save — or better persistence of the “Saving…” notification until/unless “Saved” is confirmed — is a good request!)
Is your worry more about the possibility of TiddlyHost (or some othe specific server) being down (or no longer having your login credentials active), or is it more about whether a laptop (say) is currently connected to the internet during a commute — which could obviously change at any moment?
Either way, having a frequent empty handshake with the server seems like a costly (computing/bandwidth) way to have only a 99.x% guarantee that your next save will work (given that internet connection can still be lost between the time of your last ping and the time you attempt to save to server).
Of course, I’d be happy to be persuaded otherwise. Maybe a once per minute check would not be too costly, and could yield a visually clear shift that helps remind me that I need to be mindful of the need to make local saves… (For similar reasons, I have a page-background-color difference between “reader” and “author” mode for public projects hosted on TiddlyWiki. Since I often check in another browser account to ensure things are displaying as they should for student visitors, it’s helpful for that load-instance to have a different background color. It doesn’t mean the server’s not “online” — but it does help inhibit me from jumping in to make a quick edit, since I’m not authenticated for this session.)
I do not mean whether it was loaded via http or local, but rather what the state of the device is now.
But I’m mostly thinking of the use case that if saving to the could fails due to offline, then TW could automatically download instead.
But, sure, in addition to that then, sure, a constant pinging for a little indicator icon somewhere assuming it could work in the background and not freeze up the TW. I’d be happy with a minutely check but even if it would take place much more frequently, it can’t be more costly than watching youtube videos, or doing other things online that transfers a lot of data, can it?
@pmario , thanks, that sounds like quite a few options - even if I don’t directly understand how to practically implement any of them (but I’m sure I could figure it out). Would it make sense for me to post a gh request for the info mechanism to somehow feature this, so users have an easily accessible tool for this?
That’s a coincidence. If you would have waited 6 more seconds, it would have been 59 seconds TW checks for new tiddlers every minute. So “worst case” this info goes away after 1 minute if server connection comes back.
Interesting, as I tried three separate times and each was under 5 seconds. I assumed it was something short, like perhaps 10 seconds. So that would be quite the coincidence…, but, … are you certain there’s not a faster cadence once the disconnection is noticed? Because that count in the top is incrementing a lot faster than once per minute. I haven’t gone to look into the code, because I still wouldn’t really know where to look.
The browser provides window.navigator.onLine which could be read via a js macro. if you want to know if you have network connectivity… but the website could be down all the same.
Thanks @buggyj but there’s typically a device screen indicator for general internet connection so I guess that’s enough but what is needed is wiki-source connection. (However I’m noticing now that the OP is not clear what I ask for so I’ll correct it!)