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';
import { files } from './files.ts';
const sources = await loadSources(files);
</script>
<RealtimeClocks mochi:hydrate />
More demos
View Transitions Drop <ViewTransitions /> into a shared layout to animate full-page navigations with zero JavaScript. Cache Events Subscribe to MochiCache lifecycle events through mochiEvents and log them to the server console. Cancelling form submissions cancel() prevents the fetch from firing; controller.abort() stops one mid-flight.