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
HTML Entities in Props HTML entities in a static island prop (label="Tom & Jerry") decode to their characters — identical on the server and after hydration. Isomorphic URL One import for the current URL — reads from the request on the server, window.location on the client. Background jobs with queues Offload work to a Mochi.queue() with an embedded worker — no Redis.