28 lines
610 B
TypeScript
28 lines
610 B
TypeScript
import { Jetstream } from "@skyware/jetstream";
|
|
|
|
const jetstream = new Jetstream({
|
|
wantedCollections: ["space.litenote.note"],
|
|
});
|
|
|
|
jetstream.onCreate("space.litenote.note", (event) => {
|
|
const { did, commit } = event;
|
|
console.log("create", did, commit);
|
|
});
|
|
|
|
jetstream.onUpdate("space.litenote.note", (event) => {
|
|
const { did, commit } = event;
|
|
console.log("update", did, commit);
|
|
});
|
|
|
|
jetstream.on("close", () => {
|
|
console.log("Connection closed");
|
|
});
|
|
|
|
jetstream.on("error", (error) => {
|
|
console.log("Connection closed with error", error);
|
|
});
|
|
|
|
console.log("launching jetstream");
|
|
|
|
jetstream.start();
|