Real-time channels
Define channels with typed callbacks and pattern-matched topics. Join, leave, and broadcast with compile-time guarantees on socket state — the Gleam compiler holds you to your own assigns type.
Type-safe real-time channels and presence for Gleam, targeting the Erlang (BEAM) runtime.
import berylimport beryl/presence
// Track who's online and broadcast every change to the room —// Phoenix-compatible presence diffs, backed by a CRDT.let config = presence.Config( pubsub: Some(ps), replica: "node-1", broadcast_interval_ms: 1500, on_diff: Some(fn(diff) { beryl.broadcast_presence_diff(channels, "room:lobby", diff) }), )
// …then, inside your channel's join callback:let _ref = presence.track(p, "room:lobby", "user:alice", socket.id(socket), meta)
// ps, channels, p and meta come from your app — see the Presence guide.Define channels with typed callbacks and pattern-matched topics. Join, leave, and broadcast with compile-time guarantees on socket state — the Gleam compiler holds you to your own assigns type.
Know who's online with a CRDT-backed presence system. An add-wins observed-remove set resolves joins and leaves automatically across distributed nodes.
Distributed publish/subscribe powered by Erlang's pg process groups. Works across cluster nodes with zero configuration.
A JSON array wire format compatible with Phoenix client libraries, with first-class WebSocket support via Mist integration.