Repository navigation
Implement Phase 1: core LiveView library - #5
Merged
Merged
Conversation
The server-side library for building interactive LiveView UIs over WebSocket. Users implement the LiveView trait (mount, handle_event, render), register routes via Router, and start a Listener. One _Connection actor per client handles the lifecycle: route lookup on WebSocket open, mount, initial render, event dispatch, re-render on assign changes, heartbeat ack, and idle timeout. The wire protocol is JSON over WebSocket with message types for render, event, heartbeat, push, and error. Assigns wraps TemplateValues with dirty tracking so the framework only re-renders when state actually changed. Routes is an immutable val built from Router, shareable across actors. 17 tests: 3 PonyCheck property tests for Assigns (dirty tracking, value roundtrip, template bridge), 9 wire protocol tests (4 encode, 5 decode), 4 router tests (exact match, no match, empty, query strip), 1 socket test. Adds ssl Makefile flag (required because mare depends on ssl transitively). Counter example demonstrates the full API. Design: #3
Markdown prose should flow naturally, wrapping only on paragraph boundaries.
Mare depends on ssl transitively, which requires a compile-time SSL version flag. The CI containers use LibreSSL.
The standard builder doesn't include SSL libraries. Mare depends on ssl transitively, so we need the libressl variant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 1 of livery per the design in #3 and implementation plan in #4. This is the server-side library only; the JS client lives in a separate repo.
Users implement the
LiveViewtrait (mount,handle_event,render), register routes viaRouter, and start aListener. One_Connectionactor per client handles the full lifecycle: route lookup on WebSocket open, mount, initial render, event dispatch with automatic re-render on assign changes, heartbeat ack, and idle timeout cleanup.The wire protocol is JSON over WebSocket.
AssignswrapsTemplateValuesfrom the templates library with a dirty flag so the framework skips re-rendering when nothing changed.Routesis an immutablevalfrozen fromRouter, safe to share across connection actors.17 tests cover the non-actor code: PonyCheck property tests for Assigns (dirty tracking, value roundtrip, template bridge), wire protocol encode/decode tests, router tests including query string stripping, and socket push event tests. Connection actor integration tests are deferred until the JS client is available for end-to-end testing.
Counter example demonstrates the full API. The
sslMakefile flag is new because mare depends on ssl transitively.Design: #3