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

tracking of browser process / waiting for browser close / update start args / couple of example fixes #261

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Hecatron
Copy link

Hi,
I've added a couple of changes

First I've added tracking of the browser process's launched
this can be retrieved via get_browser_process()
the idea is to use this to determine when the browser process has closed
so the python side can then close as well at the same time

Next there's a method called wait_browser_close()
this can be used to wait for browser instances to close

Next I've added a update_startargs() method, just to avoid accessing _start_args directly
What I'm doing is just using eel to launch chrome in application mode, but using a flask app as the backend

something like this

# Run Flask first
flaskserv.get_free_port()
flaskserv.start_async()

eel.update_startargs(size=(300, 200), mode='chrome', port=flaskserv.Port)
eel.show('/')
eel.wait_browser_close()

So instead of running the inbuilt bottle server, I'm running flask in a thread
(marked as a daemon so that it terminates when the main thread finishes)
then once we get past wait_browser_close() the whole app closes threads and all

@samuelhwilliams
Copy link
Collaborator

samuelhwilliams commented Jun 21, 2020

Hi @grbd - thanks for the contribution.

I'm not sure I understand the need for this yet - but I also think that supporting this interface is going to lead to a fair amount of extra complexity for Eel to manage.

The Eel server should shut down shortly after the last websocket connection is closed. I don't think we want to support tracking the browser process itself - just the connections between a browser and the Eel server. This should work even if your case where you use Flask instead of Eel's bottle. Does this not work for you? Can you explain why? What do you want to do with the tracked browser process (if not just waiting on them) and why is waiting for websockets to close insufficient?

Having an interface to update the start args seems reasonable to me - I'd be happy to accept this contribution separately.

Based on @ChrisKnott's comments here there may also be some problems trying to track browser processes closely.

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

Successfully merging this pull request may close these issues.

2 participants