Live
The live layer's front door: mount in a handler, routes on the server, the event binding attributes in views.
A handler embeds a component wherever it wants in its own page:
def board(request: Request): Response =
Response.Ok(layout(Live.mount(request, Board())))
mount runs init, registers the page, and returns a fragment of two nodes: the anchor `
` holding the first render, and the `` that brings it to life. Carrying the script in the fragment is what lets http stay blind to live (design/live.md §2.3): it never scans a response for markers, because the mount is just a value in whatever the handler returns. A whole document goes out as written and content comes back inside the application's Layout; the script travels with the mount either way. The script's address is a plain string on purpose — the socket and the script are served unmounted under the reserved prefix, so a mounted page must not have them rewritten.
One mount per response in v1. A second mount renders (each is an ordinary value) but the client drives only the first anchor it finds; multi-mount is on the backlog.
The registry and the reaper are process-wide the way the installed Database is: built once, reached from the routes below, invisible to user code.
Attributes
- Source
- Live.scala
- Graph
-
- Supertypes
- Self type
-
Live.type