A2UI.Socket (A2UI v0.3.0)

Copy Markdown View Source

WebSock handler implementing the A2UI message flow.

Bridges WebSocket connections to an A2UI.SurfaceProvider implementation. On connection, calls the provider's init/1 and surface/1 to send the initial UI. On incoming action messages, calls handle_action/2.

When a Registry is provided, the socket process registers itself on connect, enabling broadcast dispatch for push updates via A2UI.Server.push_data/3 and A2UI.Server.push_surface/2.

Arbitrary messages sent to the socket process are delegated to the provider's handle_info/2 callback (if implemented).

This module is not used directly by applications. It is configured internally by A2UI.Endpoint.

Summary

Types

t()

@type t() :: %A2UI.Socket{
  provider: module(),
  provider_state: term(),
  registry: atom() | nil,
  surface_id: String.t() | nil
}