Skip to content

feat: v0.1.0 — WebSocket server#2

Merged
23min merged 1 commit intomainfrom
feat/v0.1.0-websocket-server
Feb 9, 2026
Merged

feat: v0.1.0 — WebSocket server#2
23min merged 1 commit intomainfrom
feat/v0.1.0-websocket-server

Conversation

@23min
Copy link
Owner

@23min 23min commented Feb 9, 2026

Summary

  • Add A2UI.Server — Bandit-based HTTP + WebSocket endpoint, embeddable in any OTP supervision tree
  • Add A2UI.SurfaceProvider behaviour — applications implement init/1, surface/1, and handle_action/2 to define surfaces and handle user actions
  • Add A2UI.Socket (WebSock handler) and A2UI.Endpoint (Plug routing) as internal infrastructure
  • Ship self-contained debug renderer page (priv/static/index.html) — renders Text, Button, Card, Row, Column, CheckBox, Divider; shows message log; auto-reconnects
  • Add demo_server.exs — run mix run demo_server.exs, open http://localhost:4000

New dependencies

  • bandit (~> 1.0) — pure Elixir HTTP server
  • websock_adapter (~> 0.5) — WebSocket upgrade adapter
  • gun (~> 2.1, test-only) — WebSocket client for integration tests

Test plan

  • mix ci passes (format check + compile warnings-as-errors + 67 tests)
  • mix run demo_server.exs starts server, open http://localhost:4000 in browser
  • Click buttons in debug renderer, verify surface updates
  • Verify message log shows JSON traffic

🤖 Generated with Claude Code

Add A2UI.Server, A2UI.Socket, A2UI.Endpoint, and A2UI.SurfaceProvider
behaviour so applications can serve interactive A2UI surfaces over
WebSocket from any OTP supervision tree.

- SurfaceProvider behaviour: init/1, surface/1, handle_action/2
- WebSock handler bridging frames to provider callbacks
- Plug endpoint routing /ws (upgrade), / (debug renderer)
- OTP-compatible server wrapper with child_spec
- Self-contained debug renderer page (priv/static/index.html)
- Integration tests with real WebSocket via :gun
- 67 tests (24 new), all passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@23min 23min merged commit 1f7b6db into main Feb 9, 2026
3 checks passed
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.

1 participant