Stop Go server when browser is closed -


i'm running simple go server on osx machine. when run command run go program starts server , open browser window.

i know if there's way when close browser window (by window, not program) close server , quit terminal.

thank in advance.

you let browser emit message before dying, or use web socket, simple, reliable , usual way kind of stuff set javascript timer have browser send heart-beat message server every , (depending on how want server stop after browser's closing ; every second, every 15s, every minute... ?). when server figures due message has not arrived, can exit.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -