question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to close connections on browser window closing ?

See original GitHub issue

This is my code to run GUI, but there is issue while closing connections … How to close connection on exit ? I have set close_server_on_exit=False for not closing connection during testing a GUI.

In short, I want close connection whenever I close the browser window. How to do that ?

`from flaskwebgui import FlaskUI from main import app

FlaskUI(app, start_server=‘flask’, width=1280, height=720, close_server_on_exit=False, host=“localhost”, port=8000).run() `

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ClimenteAcommented, Oct 28, 2022

When closing the GUI (pressing X) it will not close the connection right away.

Currently that’s not possible.

1reaction
ClimenteAcommented, Oct 28, 2022

close_server_on_exit=True - for the web server on_exit=func()

Put the logic of what you want to close in ‘func’

Read more comments on GitHub >

github_iconTop Results From Across the Web

Closing web browser windows doesn't close connections
Closing the private window closed the connections associated with the window, in every browser. Thus, it seems pretty clear that this behavior ...
Read more >
Closing web browser windows doesn't close connections
On the Mac: Closing a window just closes a window. Quitting the application closes all connections sure and true. Connections can be shared ......
Read more >
Closing Web Browser Windows Doesn't Close Connections
Closing the private window closed the connections associated with the window, in every browser. Thus, it seems pretty clear that this ...
Read more >
Closing a Server connection session through a web browser
In the user menu, select Log out. The web browser window shows the page for entering account credentials. Article ID: 151471, Last review:...
Read more >
how to close a websocket like if chrome window was ...
Finally, type socket.close(); in the browser's console and run netstat -an -p tcpv6 again, you'll notice that the previous row has disappeared.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found