Client adapter
dewdrop.codec() maps Fluid join/reply events onto a channel client codec.
Fluid protocol surface for Gleam
dewdrop sits above raw Socket.IO frames and below the full Fluid protocol model. It names the canonical events, keeps their positional payloads visible, and gives client and server runtimes a narrow codec boundary.
connect_document(payload) -> 42["connect_document", payload] connect_document lives in dewdrop/events.windsock owns the raw 42[...] packet.Use dewdrop when the code needs to speak in Fluid events. Use windsock when the code only needs to parse or emit Socket.IO packet text.
import dewdrop
import gleam/json
pub fn connect_frame() {
dewdrop.encode_connect(
json.object([#("id", json.string("doc-123"))])
)
}
// 42["connect_document",{"id":"doc-123"}] dewdrop/events.encode_connect and encode_submit_op.dewdrop.codec() maps Fluid join/reply events onto a channel client codec.
import dewdrop/server
pub fn codec() {
server.server_codec()
} Each layer owns one kind of knowledge. Raw frame syntax, Fluid event names, protocol semantics, and server behavior stay separate.
Encodes and decodes raw text frames such as 42["event", ...args], plus Engine.IO heartbeat packets.
Names the Fluid event vocabulary and exposes client/server codec adapters over the windsock frame shape.
Owns protocol payloads, sequencing, sessions, JWT/auth, and domain types above event transport.
Consumes the protocol layers to run Fluid-compatible collaboration services in Gleam.
The event catalog is dependency-light so protocol packages can share the same names without inheriting a transport client or server runtime.
connect_document client -> server Begin collaboration for a document. connect_document_success server -> client Acknowledge a successful join. connect_document_error server -> client Reject a document connection attempt. submitOp client -> server Submit operation messages for sequencing. op server -> client Deliver sequenced operations back to clients. submitSignal client -> server Send non-persistent collaboration signals. signal server -> client Broadcast non-persistent collaboration signals. nack server -> client Reject submitted operations explicitly. close either Close a document connection. submitSummary client -> server Submit a summary for the document. summaryAck server -> client Acknowledge an accepted summary. summaryNack server -> client Reject a submitted summary.