Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh all when server starts #79

Closed
aknoerig opened this issue Oct 7, 2016 · 2 comments
Closed

Refresh all when server starts #79

aknoerig opened this issue Oct 7, 2016 · 2 comments
Labels

Comments

@aknoerig
Copy link

aknoerig commented Oct 7, 2016

What version are you using? (Don't say latest. Be specific.)

0.5.0

Expected result

Refresh all browser views when the node server restarts.

Actual result

The livereload socket reconnects, but it doesn't refresh the page.

Why is this important?

Livereload works fine when I edit client-side files. However it would be just as useful when I have to edit and restart the node server. This use case happens almost as often. In my case, I have to reload all open browser views manually in order to re-initialize them (for example to establish further websocket connections).

Basically, I'm looking for a command to force the refresh of all browser views, so that I can call it on server start (and possibly on other occasions).

@napcs
Copy link
Owner

napcs commented Oct 16, 2016

So here's the issue with this.

When you refresh the page manually, or when LiveReload refreshes it, it's a full refresh:

Refresh: /Users/brianhogan/dev/oss/node-livereload/.git/index

Browser connected.

Browser URL: {"command":"hello","protocols":["http://livereload.com/protocols/official-6","http://livereload.com/protocols/official-7"],"ver":"2.0.8","snipver":"1"}

So, whenever the HTML page refreshes, it literally makes a new opening connection to the server.

If we tell the LiveReload server to refresh your browser when it connects, then it will refresh infinitely because once it refreshes, it'll make the socket connection, triggering reloading.

Run LiveReload server separate from your Node application so you don't have to stop it. This works for me.

@napcs napcs closed this as completed Oct 16, 2016
@aknoerig
Copy link
Author

Thanks, I have now opted for an alternative solution. Since my issue is mostly about re-establishing other websocket connections (apart from the one livereload uses), I'm using this code:

http://stackoverflow.com/questions/3780511/reconnection-of-client-when-server-reboots-in-websocket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants