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

Reload only changed file #325

Open
penge opened this issue Aug 12, 2019 · 1 comment
Open

Reload only changed file #325

penge opened this issue Aug 12, 2019 · 1 comment

Comments

@penge
Copy link

penge commented Aug 12, 2019

live-server: 1.2.1
nodejs: 10.15.3

Right now, when an html file is changed, server reloads every open page (browser tab):

clients.forEach(function(ws) {
  if (ws) ws.send(cssChange ? 'refreshcss' : 'reload');
});

It does not take the url of ws client into consideration.
It should reload only the page that was changed (applies to html files).

Solution: in case html file is edited, send reload to only those clients matching url with the changePath.

@arm-liang
Copy link

The live-server always reload the unrelated page when I change the file that is unused in page.
Suggest:

  1. Use web socket to store every connection loaded resources
  2. When detect file change and socket broadcast all the connections and judge whether change file list in every socket stored file list to determine refresh page.

It would be difficult to store every web socket connected file, I think.

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

No branches or pull requests

2 participants