Package protocols.apps.canvas.ui
Class WebUi
java.lang.Object
protocols.apps.canvas.ui.WebUi
A tiny embedded web UI for the canvas, built on the JDK's bundled
HttpServer so the demo pulls in no HTTP dependency. It serves three
static assets from the classpath (/web/index.html, app.js,
style.css) and two JSON endpoints:
GET /api/state— the current canvas grid + this node's active-view neighbours, which the page polls a few times a second;POST /api/paint—{"x":..,"y":..,"color":0xRRGGBB}→ paints one cell (which then disseminates by gossip like any other).
Handlers run on the server's own small thread pool and call back into
CanvasApp.paintFromUi(int, int, int) / CanvasApp.stateJson(), both of which are
safe off the event loop (see CanvasApp's threading note).
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
WebUi
-
-
Method Details
-
start
Bind and start serving. Throws if the port is unavailable.- Throws:
IOException
-
stop
public void stop()
-