Closed SvenMarcus closed 1 year ago
TBH I am not sure at what time the app even gets to know when the session can be closed.
One possible solution would be the following:
We could create an endpoint that can be triggered. If this endpoint is not triggered then the session expires/can be closed after a preset time e.g. 10 minutes. If this endpoint is triggered the time is reset and runs backwards again.
In the browser the endpoint is triggered by a JavaScript heartbeat. This means that every e.g. 10 seconds an event is triggered. If the user was active in the browser then the endpoint is triggered.
@markusweigelt Sounds good to me! Feel free to add it here.
@markusweigelt I still had to fix one more problem (recursive paths did not survive in the request).
I also added a kill command so that when you close the ocrd-browser window, its corresponding broadwayd instance will be closed, too. But that still does not address the lifetime issues (when is .stop()
supposed to be called? how should the port be freed if the subprocess exited?).
Also, when opening a workspace, sometimes the background daemon/window does not get set up fast enough. So the web browser shows an empty page and does not automatically refresh it.
Ports my approach to a multi user ocrd browser to the
ocrd_manager
project. While it's a start, there are still things that require more work:SubProcessOcrdBrowserFactory
with hardcoded ports by default. Same with the main workspace directory.SubProcessOcrdBrowser
hasn't really been tested yet.atexit
handler doesn't always seem to end all running browsers before the application is shut down by the OS. That's probably not an issue if server and the browser subprocesses are running together in a single container.