From d9d794ba1d7589653775136072724651ef97ee7a Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Sun, 8 Feb 2026 01:50:11 +0100 Subject: [PATCH] it happened! --- main.ts | 54 ++++++++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/main.ts b/main.ts index a879aa9..7313f6b 100644 --- a/main.ts +++ b/main.ts @@ -2,39 +2,37 @@ import { Jetstream } from "@skyware/jetstream"; const jetstream = new Jetstream({ wantedCollections: [ - "site.standard.graph.subscription", - "site.standard.publication", - "site.standard.document", "space.litenote.note", ], }); -// Handle standard posts -jetstream.onCreate("site.standard.graph.subscription", (event) => { - // Check if it references litenote content - const { did, commit } = event - console.log(did, commit); -}); - -jetstream.onCreate("site.standard.publication", (event) => { - // Check if it references litenote content - const { did, commit } = event - console.log(did, commit); - -}); - -// Handle standard posts -jetstream.onCreate("site.standard.document", (event) => { - // Check if it references litenote content - const { did, commit } = event - console.log(did, commit); -}); - -// Handle your custom posts jetstream.onCreate("space.litenote.note", (event) => { - // Process litenote-specific data const { did, commit } = event - console.log(did, commit); + console.log("create", did, commit); + }); -jetstream.start(); \ No newline at end of file +jetstream.onUpdate("space.litenote.note", (event) => { + const { did, commit } = event + console.log("update", did, commit); +}); + + +jetstream.on("close", () => { + console.log("Connection closed, PartySocket will reconnect automatically"); +}); + +console.log("launching jetstream") + +jetstream.start(); + +// Keep the process alive and provide a health check +Bun.serve({ + port: 3000, + routes: { + "/health": () => new Response("ok"), + }, + fetch() { + return new Response("Not Found", { status: 404 }); + }, +});