jetstream client
atproto jetstream client
README.md

jetstream #

the Zig SDK for Jetstream v2: live subscriptions, filtered archive replay, and replay-to-live cutover. follows the official Go client's shape, with multi-host live failover. built on zat for AT Protocol support.

install #

requires Zig 0.16.0.

zig fetch --save https://tangled.org/zat.dev/jetstream/archive/v0.1.5.tar.gz

add the module to your executable in build.zig:

const jetstream = b.dependency("jetstream", .{}).module("jetstream");
exe.root_module.addImport("jetstream", jetstream);

see the changelog for release changes.

use #

subscribe to live posts without an API key:

const std = @import("std");
const jetstream = @import("jetstream");

const Handler = struct {
    pub fn onEvent(_: *@This(), event: jetstream.Event) bool {
        std.debug.print("{d} {s}\n", .{ event.seq, event.did });
        return true;
    }
};

pub fn main(init: std.process.Init) !void {
    var handler = Handler{};
    try jetstream.subscribe(init.io, init.gpa, .{
        .hosts = &.{"https://stream.waow.tech"},
        .collections = &.{"app.bsky.feed.post"},
        .kinds = &.{.commit},
    }, &handler);
}

provide multiple hosts for live failover. use after_seq for archive replay, or live_cursor to resume within live retention; the client contract covers cursor scope, authentication, and error handling. return false from onEvent to stop.

develop #

zig build test --summary all
zig build
checks/run ci

the loopback checks require Go 1.27, Bash, and jq. they compare the local SDK with the pinned official Go client and record bounded live/catch-up measurements. see verification and release gates.

docs #

docs/ covers the client contract, failover, and upstream comparisons. examples/ contains bounded consumers and smoke programs.

license #

MIT