Scheduled jobs with cron
A Mochi.cron() job appends one entry to an in-memory log every minute. The browser subscribes over a WebSocket and shows each new row the moment it lands.
<script>
import CronLog from './CronLog.svelte';
</script>
<CronLog mochi:hydrate />
More demos
Using form return data How form action return data works — an action returns success({...}); {@attach enhance(...)} updates the UI in place, plain HTML re-renders. Real-time Streams How server-sent events and WebSocket streaming work — live SSE and WebSocket clocks, lazily hydrated via mochi:hydrate:visible. Cache Events How cache events work — subscribe to MochiCache lifecycle events (hit, miss, set, evict) through mochiEvents for observability.