Real-time Streams
You can build a WebSocket clock and a Server-Sent Events clock side by side, ticking every second. The component hydrates only when scrolled into view via mochi:hydrate:visible with a 100px rootMargin.
WebSocket connecting
--:--:-- /ws/timeSSE connecting
--:--:-- /sse/time$props.id(): s1
<script>
import RealtimeClocks from './RealtimeClocks.svelte';
</script>
<RealtimeClocks mochi:hydrate />
More demos
Static Directories How staticDirs works — mount a whole directory tree under a URL prefix as one Bun route, with Content-Type / ETag / Range / index.html from Bun and no per-file registration. Hello World How server-side rendering works — a Mochi.page() renders Svelte on the server and ships zero JavaScript. File Uploads via form actions How file uploads through form actions work — multipart/form-data validated with fail() and success(), shown enhanced and plain.