Fluid protocol surface for Gleam

Fluid event vocabulary, with adapters at the edge.

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.

dewdrop boundary connect_document(payload) -> 42["connect_document", payload]
Fluid name
connect_document lives in dewdrop/events.
Frame shape
windsock owns the raw 42[...] packet.
Runtime edge
Client and server adapters translate events into codec messages.

Small API, exact output.

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"}]

What dewdrop owns

  • Fluid event constants in dewdrop/events.
  • Common client encoders like encode_connect and encode_submit_op.
  • Codec adapters that let client and server runtimes speak the same Fluid event stream.

Client adapter

dewdrop.codec() maps Fluid join/reply events onto a channel client codec.

Server adapter

import dewdrop/server

pub fn codec() {
  server.server_codec()
}

The split is a stack, not a bigger package.

Each layer owns one kind of knowledge. Raw frame syntax, Fluid event names, protocol semantics, and server behavior stay separate.

windsock

Socket.IO frame primitives

Encodes and decodes raw text frames such as 42["event", ...args], plus Engine.IO heartbeat packets.

dewdrop

Fluid events and adapters

Names the Fluid event vocabulary and exposes client/server codec adapters over the windsock frame shape.

spillway

Raw Fluid protocol model

Owns protocol payloads, sequencing, sessions, JWT/auth, and domain types above event transport.

levee

Server runtime target

Consumes the protocol layers to run Fluid-compatible collaboration services in Gleam.

Fluid event vocabulary, ready to import.

The event catalog is dependency-light so protocol packages can share the same names without inheriting a transport client or server runtime.

Event Direction Purpose
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.