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
Post a Comment