[SEND][ACK]

Features

Every way an event needs to travel

Live to clients, durably to services, signed to webhooks and as web push, from one publish to one topic. Here's everything Sendack does today, and what's built but not on sendack.dev yet.

Topics with positions

Every event lands in its topic at a position, in order and kept. Publishing is idempotent by an id you choose, so a retry is found, not delivered twice.

Live channels

WebSockets to browsers and apps that resume from the exact position a client last saw: no gaps, no repeats, even across server restarts.

Durable subscriptions

Pull with explicit acks; what isn't acked comes back with backoff, past a limit it goes to a dead-letter topic, and you can seek back and replay.

Signed webhooks

Deliveries to outside URLs, signed with HMAC-SHA256 in the webhook-signature headers, in order, at least once, retried, with a delivery log and redeliver.

Web push

Notifications to people's browsers when they're away (VAPID), by each person's preferences and quiet hours, quiet while their app is open.

Presence

Who is connected to a topic right now, on any server, plus client events and typing that are never stored.

Chat building blocks

Threads, reactions, read state per topic and per thread, and unread counts, on the same topics and the same delivery.

Retention per topic

Keep a topic's history for ever, for an age, or to its newest N events. Expired events are hidden from reads and swept.

TypeScript, Python and Rust

@sendack/client runs as it is in Node, Deno, Bun, browsers and Workers, with no dependencies. Python and Rust have the same calls.

API keys for your server

Made on the Keys page, shown once and kept only as a hash. A key publishes and subscribes under its team's topics and manages nothing.

Functions on events

Bind a topic to a workflow and each event starts it, in order, with dead letters and replay.

Built · not on sendack.dev yet

Email when unread

If a notification is still unread after a delay, it's emailed once; read in time, it never is.

Built · sender not switched on yet

Durable subscriptions

Acknowledged, retried, never silently dropped

Each subscription keeps its own cursor. An event your consumer acks moves it on; one it nacks or doesn't ack in time comes back with backoff, and past the attempts you set it goes to a dead-letter topic, where you can replay it.

retryreplayEventat its positionPullyour consumerAckdone, cursor movesNack or time-outredelivered, backoffDead letterspast max attemptsACKretryreplayEventat its positionPullyour consumerAckcursor movesNackredeliveredDead letterspast attempts
An event is pulled; an ack moves the cursor on; a nack or a time-out redelivers it with backoff; past the maximum attempts it goes to the dead letters, which can be replayed.

Publish

Safe to retry, by design

Give each event an id. Publishing the same id with the same data again finds the first one instead of delivering a copy, so your publisher can retry after any failure without double-sending.

  • An answer carries the event's position
  • duplicate tells you it was already there
  • Batches go through the same path

Publishing in the quickstart

docs/samples/typescript · publish.mjs
import { jsonBytes } from "@sendack/client";

export async function publish(sendack) {
  // The id makes a retry safe: the same id with the same data is found, not delivered twice.
  const first = await sendack.publish("orders", "order-1001", jsonBytes({ total: 42 }));
  const retry = await sendack.publish("orders", "order-1001", jsonBytes({ total: 42 }));
  console.log(first.pos, first.duplicate, retry.duplicate); // 7.0 false true
  return [first, retry];
}

Subscribe

Live, and exact after a drop

subscribe() follows a topic from now, and after a dropped connection resumes from the last position it saw. Positions come from the database's own commit order, so a resume is exact: nothing missed, nothing twice.

  • Resume from any position, not a short window
  • History by page from any point
  • The same in TypeScript, Python and Rust

Subscribing in the quickstart

docs/samples/typescript · subscribe.mjs
import { json } from "@sendack/client";

export async function subscribe(sendack) {
  // Live from now; it resumes by itself after a drop, with no gap and no repeat.
  for await (const ev of sendack.subscribe("orders")) {
    console.log(ev.pos, ev.id, json(ev.data));
    return ev; // a service keeps looping; this takes the first event and stops
  }
}

Webhooks

Deliveries your customers can verify

Each delivery carries webhook-id, webhook-timestamp and webhook-signature. The clients' verifyWebhook checks the signature against the raw body in constant time and refuses replays outside the tolerance.

  • The same webhook-id on a retry: dedupe on it
  • Retries from 1 s doubling to 60 s, honouring Retry-After
  • Rotate a secret with an overlap; both verify

Verifying webhooks

docs/samples/typescript · webhook.mjs
import { verifyWebhook } from "@sendack/client";

export async function createWebhook(sendack) {
  // The secret (whsec_...) is answered once: keep it.
  return sendack.createWebhook("orders-hook", "orders", "https://example.com/hooks/sendack");
}

// In your HTTP handler: the headers, and the body as raw bytes, exactly as they arrived.
export async function verifyDelivery(secret, headers, rawBody) {
  const event = await verifyWebhook(secret, headers, rawBody); // throws WebhookVerificationError, with a .kind
  console.log(event.topic, event.id, event.pos);
  return event; // answer 2xx only now
}

Delivery log

See every failure, and send it again

Each webhook keeps a log of its deliveries: position, status and whether it worked. Redeliver any of them, signed again, with the same webhook-id so the receiver can dedupe.

Failures in the quickstart

docs/samples/typescript · failures.mjs
export async function failures(sendack) {
  const { deliveries } = await sendack.webhookDeliveries("orders-hook", { limit: 20 }); // newest first
  for (const d of deliveries) console.log(d.pos, d.ok ? "ok" : "failed", d.status);
  const failed = deliveries.find((d) => !d.ok);
  if (!failed) return null;
  // Sends that event again, signed, and answers the attempt it made.
  return sendack.webhookRedeliver("orders-hook", failed.pos);
}

Clients

The same publish in three languages

docs/samples/python · publish.py
import json

def publish(sendack):
    # The id makes a retry safe: the same id with the same data is found, not delivered twice.
    data = json.dumps({"total": 42}).encode()
    first = sendack.publish("orders", "order-1001", data)
    retry = sendack.publish("orders", "order-1001", data)
    print(first.pos, first.duplicate, retry.duplicate)  # 7.0 False True
    return first, retry
docs/samples/rust · publish.rs
use sendack_client::{Client, Error, Published};

pub async fn publish(sendack: &Client) -> Result<(Published, Published), Error> {
    // The id makes a retry safe: the same id with the same data is found, not delivered twice.
    let first = sendack.publish("orders", "order-1001", r#"{"total":42}"#).await?;
    let retry = sendack.publish("orders", "order-1001", r#"{"total":42}"#).await?;
    println!("{:?} {} {}", first.pos, first.duplicate, retry.duplicate); // Some("7.0") false true
    Ok((first, retry))
}

Try it with the quickstart

Sign up freeQuickstart