resume()
once.
Vue
Svelte
Next.js and SSR
React Native
Node, Bun, and Deno
Electron and workers
chat.ts
Vue
Wrap the state in ashallowRef. Each snapshot is immutable, so a shallow ref
is enough:
useChat.ts
Svelte
subscribe already matches the store contract:
chat-store.ts
chat.resume() once, for example in onMount of your root component.
Next.js, Nuxt, SvelteKit, Remix, and Astro
Nothing toucheswindow or storage at import time, and createClient does no
work until you call a method. You can import the client on the server and call
resume() and sendMessage() from client-side code only. In Next.js, mark
components that use the chat with "use client".
React Native and Expo
There’s nolocalStorage, so pass AsyncStorage to keep the visitor’s session
across app launches:
chat.ts
useSyncExternalStore hook as in
Getting started, and render with
FlatList and TextInput.
To upload a file from a picker, pass its contents as a blob:
Node, Bun, and Deno
On a server, keep the session in memory. Each client is one visitor, so create one client per end user:npm:@typewise/chat-sdk. Call chat.destroy() when the user’s
session ends, to close the real-time connection.
Calls from a server arrive without a browser
Origin header, so the Domain
allowlist doesn’t apply to them.Electron and Web Workers
Both work without changes. In a Web Worker, there’s nolocalStorage, so the
SDK keeps the session in memory unless you pass your own storage adapter.