🍡 mochi
SSR framework for Svelte 5 + Bun with islands-based selective hydration
Server-Sent Events
Mochi.sse() creates SSE streams. The handler receives a stream with send(), close(), and onClose():
"/sse/time": Mochi.sse((stream) => {
stream.send(new Date().toISOString());
const interval = setInterval(() => {
stream.send(new Date().toISOString());
}, 1000);
stream.onClose(() => clearInterval(interval));
}),send() accepts an optional second argument with event and id fields for named events.