python-eel/Eel

Restart the server automatically when it shuts off

Open

#305 opened on May 25, 2020

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Python (570 forks)batch import
help wanted

Repository metrics

Stars
 (5,980 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

The problem Hi,

I'm having an issue where the server suddenly disconnects, and for some reason this happens a lot. This forces me to restart the server and open a new window every time, and of course that's not ideal for the users. So I was wondering if there is a way to use the close_callback to restart the server without having to open a new window every time.

I tried the following code and it successfully restarts the server, but it opens a new window every time a redirecting button/link is clicked even if the server is still running.

import eel

eel.init('UI')

def callback(path, websockets):
        eel.start(path, port=5002, close_callback=callback)

eel.start('/Templates/admin/employees.html', port=5002, close_callback=callback)

And if I set the 'mode' argument to False, then the server restarts only if it is closed first, but the current window won't be connected to it, and I have to open a new window to connect to the server.

Desktop:

  • OS: Windows
  • Browser: Chrome - v81.0.4044.138 (Official Build) (64-bit)
  • Eel version: 0.12.3

Contributor guide