Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep working on disconnect from network #161

Open
david-a-wheeler opened this issue Sep 16, 2023 · 10 comments
Open

Keep working on disconnect from network #161

david-a-wheeler opened this issue Sep 16, 2023 · 10 comments
Labels
question Further information is requested

Comments

@david-a-wheeler
Copy link
Contributor

After viewing the metamath-lamp page and downloading the mm database (set.mm), I often end up disconnected (especially on my phone, but also sometimes my laptop).

It'd be nice if metamath-lamp kept working during a disconnect, as long as the app and relevant database(s) were downloaded.

@expln
Copy link
Owner

expln commented Sep 17, 2023

I tested this situation and metamath-lamp kept working for me. Do you see any error after a disconnect? Or any functionality stops working? As I know, metamath-lamp keeps working after a disconnect until you refresh the page.

@expln
Copy link
Owner

expln commented Oct 15, 2024

@david-a-wheeler

Hi David. Could you please provide more details on the disconnect issue? As I wrote in my last comment, mm-lamp keeps working on disconnect.

@expln
Copy link
Owner

expln commented Feb 8, 2025

Looks like I reproduced this issue. I worked in mm-lamp on my phone. Then I locked the phone. I wanted to resume my work in about 4 hours. But the page with mm-lamp was reloaded automatically as soon as I opened it.

I think this depends on the browser. Looks like browsers on phones reload pages after some time of inactivity. I never experienced such auto reloads in browsers on laptops. Mm-lamp doesn’t have any functionality to reload itself. I don’t think I can do anything with that. But I will leave this issue open as a reminder that this problem exists.

@david-a-wheeler
Copy link
Contributor Author

Ah, thanks! It does look like it's especially likely when you lock a phone. I did find this:
https://stackoverflow.com/questions/59085507/is-there-a-function-to-stop-mobile-android-browser-from-automatically-reloading

@expln
Copy link
Owner

expln commented Feb 9, 2025

This confirms my guess that this is purely a browser issue and I will not be able to resolve it. Thanks for the research. Do you think this issue may be closed? Or you have any idea how this can be resolved?

@expln expln added the question Further information is requested label Feb 9, 2025
@david-a-wheeler
Copy link
Contributor Author

Let me do a little research first. In some sense all that matters is that it can impact users. If there's a workaround, we should document it (or implement it if there is one).

@david-a-wheeler
Copy link
Contributor Author

Basically, we want to discourage the web browser from discarding this page, especially if the user knows they're about to lose Internet connectivity.

Here are some useful pointers:

I've learned that in Chrome there's a setting called "Always keep these sites active" ("Sites you add will always stay active and memory won't be freed up from them"), where you can "add sites manually". Firefox & other browsers may have similar mechanisms. Testing is needed, but if that would solve the problem, it should be documented. Then people (like me) can prevent the reload.

@expln
Copy link
Owner

expln commented Feb 10, 2025

Thanks for the ideas. I will check.

@david-a-wheeler
Copy link
Contributor Author

At the very least, we can add something like this to the documentation:

Preventing discards for disconnected operations

Once this application loads whatever database it needs, it can work without an internet connection (aka "disconnected operations"). However, web browsers often discard tabs to save memory, under the presumption that they can reload data later. Obviously reloading information from the internet won't work if there's no internet connection.

If you know you will lose your internet connection, you may be able to keep using the application if you plan ahead. The details depend on your web browser:

  • If you're using the desktop Chrome web browser, you can open the URL chrome://discards/, and look for the row for "Metamath lamp" (URL https://expln.github.io/lamp. Go to the column "Auto Discardable" and click its toggle so it shows an "X" (do not auto discard).
  • In all browsers, try to keep that tab visible. Browsers generally try to avoid discarding tabs if they are currently visible.

@expln
Copy link
Owner

expln commented Feb 10, 2025

Yes, this is a good note. Will you add it?

As of working completely offline, I can add a JavaScript script which should be launched with node.js. This script will start a local web server and serve mm-lamp resources. This will work completely without internet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants