Arcana::Server
Network gateway — exposes the Bus and Directory over WebSocket + REST.
WebSocket clients connect, join with an address, and become full participants on the local Bus. Transparent bridging — local actors don't know whether they're talking to a local or remote agent.
REST endpoints expose the Directory for discovery and health checks.
bus = Arcana::Bus.new dir = Arcana::Directory.new server = Arcana::Server.new(bus, dir, port: 19118) server.start # blocking
Constructors
Instance methods
When true, every REST request (except /health) and every WebSocket
upgrade must present a valid Authorization: Bearer ak_... header
that resolves via Arcana::Auth::ApiKey.verify. Requires the identity
store (ARCANA_DATABASE_URL).
When true, every REST request (except /health) and every WebSocket
upgrade must present a valid Authorization: Bearer ak_... header
that resolves via Arcana::Auth::ApiKey.verify. Requires the identity
store (ARCANA_DATABASE_URL).
Optional event recorder for auth failures and server lifecycle.
Callback invoked after every state-changing REST op (/register,
/unregister). The daemon wires this to Snapshot.save so state
is persisted through the same path as graceful-shutdown saves —
which respects the ephemeral flag and doesn't accumulate
code-registered zombies across restarts.
Callback invoked after every state-changing REST op (/register,
/unregister). The daemon wires this to Snapshot.save so state
is persisted through the same path as graceful-shutdown saves —
which respects the ephemeral flag and doesn't accumulate
code-registered zombies across restarts.
TODO: Revisit token auth — currently a simple shared secret per address. Consider JWT, expiry, or key length requirements if Arcana is ever exposed beyond localhost.