Getting Started
Client setup
Connect FluxyChat to React, vanilla JavaScript, React Native, or Flutter.
FluxyChat clients talk to your Worker URL. Public rooms: publishableKey on FluxyRealtimeProvider, or joinPublicRoomAsGuest. Private rooms need a member JWT. fc_ keys stay on the server. React is the client we document first. Vue and Svelte on npm are best-effort. React Native is on npm. Flutter, Swift, and KMP stay in-repo until pub.dev and CocoaPods.
import { FluxyRealtimeProvider, useChat } from "@fluxy-chat/react";
<FluxyRealtimeProvider workerUrl={workerUrl} publishableKey="pk_...">
<Room />
</FluxyRealtimeProvider>
function Room() {
const { messages, sendMessage } = useChat({ roomId: "general" });
}The room must be public. The SDK mints an anonymous guest JWT. Without a pk_ (self-host + PUBLIC_GUEST_ENABLED):
import { FluxyChatClient } from "@fluxy-chat/sdk";
const session = await FluxyChatClient.joinPublicRoomAsGuest(workerUrl, publicRoomId, {
displayName: "Ada",
});Production apps mint JWTs after sign-in (Auth JWT).
Auth
Guest for public rooms (publishableKey or joinPublicRoomAsGuest). Member JWTs from your backend for everything else. Never embed fc_… in client bundles. Refresh with client.setToken() / updateToken(). See Auth JWT.
Common errors
| Error | Fix |
|---|---|
401 Unauthorized | Token expired or wrong signing key. Mint a fresh JWT. |
not a member | Add the user to the room via REST or dashboard |
| WebSocket blocked | Check CORS / custom domain; try HTTP long-poll fallback |
More: Troubleshooting.