Real-time Chat
An example of building a simple in-memory chat using a hydrated island and the built-in WebSocket support in Bun. The server stores message history and replays it to new connections; ws.publish() broadcasts each message to all clients. Open this page in two tabs to see them sync in real time.
Chat
<script>
import ChatWidget from './ChatWidget.svelte';
import { files } from './files.ts';
const sources = await loadSources(files);
</script>
<ChatWidget mochi:hydrate />
More demos
Error Boundaries Contain island failures with <svelte:boundary> so one broken component does not crash the page. Real-time Streams WebSocket and SSE clocks, lazily hydrated via mochi:hydrate:visible. Form Errors A thrown action error shown inline via {@attach enhance(...)}, or as the Mochi error page on plain submit.