Inspired by LightTable's browser connect mode.
A packaged version of the server is available here. After
unpackaging the zip file, you can run the server by doing
sh start -Dhttp.port=9001
. You must have at least Java 7 installed in
order to be able to run it.
A JavaScript client that connects to the server through WebSockets and waits for orders. Include this into your templates like so:
<script src="http://localhost:9001/ws"></script>
Order the client (/ws
) to reload all the CSS files in all the
templates that it has been loaded in.
curl localhost:9001/reloadCSS
Order the client (/ws
) to reload all the pages that it has been
loaded in.
curl localhost:9001/reloadPage
Order the client (/ws
) to evaluate as JavaScript any arbitrary bit of
text that is passed in as the body of the POST
request.
curl -XPOST localhost:9001/evaluateJS -d 'alert("Hello, World!");'