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
Cache Events How cache events work — subscribe to MochiCache lifecycle events (hit, miss, set, evict) through mochiEvents for observability. Cookie Vary Test How cookie-partitioned caching works — a page that sets Vary: Cookie so responses key on cookies. Real-time Chat How WebSocket routes work — a hydrated island over Mochi.ws() with pub/sub broadcast and in-memory history.