Module Spindle_mcp.Changes

What the application tells the server changed, so every client listening to it hears: the one value of the server's that outlives a request.

let changes =
  Spindle_mcp.Changes.create ()
    (* as a journal grows *)
    Spindle_mcp.Changes.updated changes "haf://intents/0197/journal"

A client opens subscriptions/listen naming the URIs it watches, and is told notifications/resources/updated for each change to one of them, as the change is made -- "read it again", never what changed, so a client that missed one reads what it holds. A listen is one request held open: while it is open, the hub lists it, and once it ends it is gone, so the server keeps nothing of a client between requests. A listen that cannot keep up -- depth changes it has not been sent -- is dropped, ending with no result, and its client listens again and reads from where it was.

type t
val create : ?depth:int -> unit -> t

depth (16) is how many changes a listen may fall behind before it is dropped. Raises Invalid_argument for a depth below one, as Spindle.Broadcast.create does.

val updated : t -> string -> unit

updated t uri: uri changed. Every listen that watches it is told, and nothing waits: one that cannot keep up is dropped.

val watched : t -> string list

The URIs some open listen watches.

val close : t -> unit

Ends every listen, each with the graceful result, which tells its client the server ended it: what a server that is stopping calls, in Spindle.Server.run's on_stop, since a listen never ends on its own.