elnode icon indicating copy to clipboard operation
elnode copied to clipboard

Not a proper issue...but how do you auto refresh browser upon file changes?

Open paxperscientiam opened this issue 8 years ago • 1 comments

Hi uicferrier! First off, thank you for the awesome elnode.

I'm a big fan of emacs and emacs lisps, though I still have much to learn. It's continually exciting to see how extensible emacs really is.

I'm trying to wrap my mind around elnode. One thing in particular that I'm having trouble figuring out is how to auto-refresh the browser (when served files and directories change) with elnode alone (that is, without using additional tools).

Actually, a command would work nicely too when paired with 'firestarter.'

I know that many authors on github don't like "how to" questions, so please do pardon the faux pas.

paxperscientiam avatar Nov 23 '15 13:11 paxperscientiam

I did not pinpoint how this is done in elnode, but one way to implement this is to inject code (JavaScript) in the client side browser to reload the page when there are filesystem changes. The injected client side code maintains contact (through web sockets or polling) with the server so that it stays informed of any changes on the filesystem. The server either is watching for changes in the filesystem either through polling (constantly checking filesystem on an interval) or through filesystem change events if available (for example via kqueue on FreeBSD). See livereload-js for an example of client side code and middleman-livereload for an example of a corresponding server side implementation.

preetpalS avatar Jun 27 '17 10:06 preetpalS