realize
realize copied to clipboard
Refresh browsers when binary file is rebuilt
Proposed feature:
- Option to automatically refresh the relevant page on Chrome, Firefox and Safari when
realize start
rebuilds the Go binary file.
If this isn't a planned feature, could someone suggest what they use to automatically refresh a browser to reflect the latest changes?
i need to check how its work a browser refresh system
I think air & fresh does this: https://github.com/pilu/fresh https://github.com/cosmtrek/air
Edit: Just tested air, it doesn't seem to do this. Best resource I've found is:
- https://github.com/markvincze/golang-reload-browser and
- BrowserSync + golang: https://sequentialread.com/live-reloading-golang-server-with-gulp-and-browser-sync/
Great Idea.
I've been spending ages looking for a tool that does this in golang, I've become accustomed to it from other languages' web frameworks (which recompile and auto refresh the browser on file changes), this would be an awesome addition!
The way I imagine this working is we would include some javascript in our app which could be loaded from the realize web server
<script src="http://localhost:5001/autorefresh.js"></script>
(we could do this conditionally depending if we're running in production mode or not, I don't think it would be wise or worth the effort to have Realize proxy the app and inject the script)
- Realize would need to have a websocket server enabled, this JS would connect to that socket.
- The user would change the app
- Realize would rebuild and rerun the app
- Realize would then send a message via the websocket which would let the JS know it's time to reload
- The magic happens
I would contribute if you're desperate for someone else to do this, but I'm quite new to go - to the point where I'm looking for the best frameworks and code reload tools :-)
It seems that most of what needed would be in the example https://github.com/markvincze/golang-reload-browser that @stephenkoo posted.
i prefer the proxy approach, but i don't know how to get the app url that could be preset or not depending on the type of project