Skip to content

Implement Phase 1: core LiveView library - #5

Merged
SeanTAllen merged 4 commits into
mainfrom
sean/phase-1
Mar 11, 2026
Merged

SeanTAllen merged 4 commits into
mainfrom
sean/phase-1

Conversation

@SeanTAllen

Copy link
Copy Markdown
Member

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 LiveView trait (mount, handle_event, render), register routes via Router, and start a Listener. One _Connection actor 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. Assigns wraps TemplateValues from the templates library with a dirty flag so the framework skips re-rendering when nothing changed. Routes is an immutable val frozen from Router, 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 ssl Makefile flag is new because mare depends on ssl transitively.

Design: #3

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.
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Mar 11, 2026
@SeanTAllen
SeanTAllen merged commit b15d182 into main Mar 11, 2026
7 checks passed
@SeanTAllen
SeanTAllen deleted the sean/phase-1 branch March 11, 2026 12:13
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants