Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently if a browser tab connects to a servor instance with livereload enabled and the instance process is then terminated.. the following errors appear in the browser console:
Its seems that the first error occurs because the keep-alive connection is not closed properly. This can be fixed by adding some cleanup logic on
SIGINT
:That then just leave this error in the console which appears to be coming from chrome trying to reconnect to the closed keep-alive connection at 1 second intervals (not sure where to find documentation on this behaviour):
If a server is then started again on the same port then chrome stops erroring as the connection is re-established which means the next time files change, the browser will reload.
My issue with this implementation is that if the developer terminates the process, then makes changes, then restarts the server.. then the connection will be re-established but what is displayed in the browser window is now not representitive of the current state of the file system until the next file change.
The proposal here is to reload the page upon the livereload connection being re-established: