skills/fishjam/references/js-server-sdk/SKILL.md
Node.js / TypeScript server SDK for Fishjam — backends that create rooms, mint peer tokens, listen to server notifications, and run agents. Use when writing a Node.js / Express / Fastify / Hono / NestJS backend that talks to Fishjam, sets up a webhook receiver, runs an AI agent, or generates livestream tokens. Trigger on: '@fishjam-cloud/js-server-sdk', 'FishjamClient', 'FishjamWSNotifier', 'FishjamAgent', 'createPeer', 'createRoom', 'createAgent', 'createVapiAgent', 'createLivestreamStreamerToken', 'createLivestreamViewerToken', 'refreshPeerToken', 'subscribeTracks', 'subscribePeer', 'createMoqToken', 'ServerMessage', 'roomCreated', 'peerAdded', 'trackAdded', 'fishjam backend Node', 'express fishjam', 'fastify fishjam', 'gemini agent fishjam', 'vapi fishjam'. Covers REST, WebSocket notifier, webhook protobuf decoding, FishjamAgent, and Gemini Live integration.
npx skillsauth add software-mansion-labs/skills fishjam-js-server-sdkInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
@fishjam-cloud/js-server-sdk — server-side Node.js / TypeScript SDK for the Fishjam platform.
Read
../platform/SKILL.mdfirst. It defines rooms, peers, tracks, management tokens, peer tokens, and the WS-vs-webhook tradeoff that this skill builds on.
| Component | What it does | Reference |
|---|---|---|
| FishjamClient | REST client — rooms, peers, agents, livestream/MoQ tokens, subscribe modes. | client.md |
| FishjamWSNotifier | Subscribes to all 18 server events over a single WebSocket. Best for long-lived workers. | ws-notifier.md |
| FishjamAgent | Programmatic peer — sends/receives audio frames over a server-side WS. Used for AI agents (Gemini, custom). | agent.md |
Webhook receivers are not a class — you decode ServerMessage protobuf yourself; covered in webhooks.md.
npm install @fishjam-cloud/js-server-sdk
# or yarn add @fishjam-cloud/js-server-sdk
import { FishjamClient } from '@fishjam-cloud/js-server-sdk';
const fishjamClient = new FishjamClient({
fishjamId: process.env.FISHJAM_ID!,
managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!,
});
const room = await fishjamClient.createRoom();
const { peer, peerToken } = await fishjamClient.createPeer(room.id, {
metadata: { userId: 'user-123' },
});
// ship `peerToken` to your client
| Task | Reference |
|---|---|
| Call any REST method (rooms, peers, subscribe, refresh) | client.md |
| Subscribe to server events from a long-lived worker | ws-notifier.md |
| Receive events from a serverless / scaled-out backend | webhooks.md |
| Build an AI voice agent (audio in/out, image capture) | agent.md |
| Wire a Gemini Live agent into a room | gemini-integration.md |
| Wire all of this into Express or Fastify | express-fastify.md |
| Issue livestream streamer/viewer tokens or MoQ tokens | livestream-and-moq.md |
| Use manual subscribe mode (cost / privacy / staging) | selective-subscriptions.md |
FishjamClient per process. It's a thin axios wrapper — share, don't recreate per request.mapException, throwing typed errors (BadRequestException 400, UnauthorizedException 401, RoomNotFoundException / PeerNotFoundException / FishjamNotFoundException 404, ServiceUnavailableException 503, UnknownException for anything else — including 403). All inherit from FishjamBaseException, which is useful for a catch-all instanceof branch. ForbiddenException is exported but never produced by the current mapper. Match on these to map to HTTP status codes. Constructor also throws MissingFishjamIdException synchronously if fishjamId is falsy.NEXT_PUBLIC_*, VITE_*, or any bundled env. If exposed, regenerate from the Dashboard.x-fishjam-api-deprecated once per process. If you see it, plan a migration — don't silence it.FishjamWSNotifier does NOT auto-reconnect. The constructor opens one WS; if it closes, you must reinstantiate. Wrap it in a supervisor or use webhooks instead.refreshPeerToken to mint a new one and ship it to the client.| File | When to read |
|---|---|
| client.md | The REST surface — every method on FishjamClient with signatures and examples. |
| ws-notifier.md | FishjamWSNotifier wiring, the 18 events, reconnection patterns. |
| webhooks.md | Decoding application/x-protobuf webhook bodies with ServerMessage.decode. |
| agent.md | FishjamAgent — opus/pcm16, createTrack, sendData, captureImage, interruptTrack. |
| gemini-integration.md | @fishjam-cloud/js-server-sdk/gemini — createClient, audio settings, end-to-end demo. |
| express-fastify.md | Production wiring — /api/join-room, error mapping, webhook routes, Fastify plugin. |
| livestream-and-moq.md | createLivestreamStreamerToken, createLivestreamViewerToken, createMoqToken. |
| selective-subscriptions.md | subscribePeer / subscribeTracks with peers created using subscribeMode: 'manual'. |
development
Use when the user mentions migrating deep links, switching away from Branch or AppsFlyer, replacing their deep linking SDK, setting up Detour deep linking for the first time, or asks how Branch/AppsFlyer concepts map to Detour. Covers the complete migration end to end - Detour Dashboard configuration, Universal Links and App Links setup, SDK swap with code examples, and analytics migration. Works across Android, iOS, React Native, and Flutter.
development
Complete onboarding guide for developers who are new to Detour, the open-source deferred deep linking SDK by Software Mansion. Use this skill whenever a user asks what Detour is, how to get started with Detour, how to set up deep linking with Detour, how to install the Detour SDK, how to configure the Detour dashboard, or how deferred deep linking works. Also use it when the user has no prior deep linking setup and wants to add deep links to their app. Covers everything from zero to production: account setup, dashboard configuration, Universal Links and App Links, platform SDK integration for React Native, iOS, Android, and Flutter, analytics, and architecture.
tools
React Native / Expo SDK for Fishjam — video/audio streaming on iOS and Android. Use when writing a React Native or Expo app that calls Fishjam, configures the Fishjam Expo plugin, sets up permissions, runs background streaming, integrates CallKit, or renders RTCView. Trigger on: '@fishjam-cloud/react-native-client', 'fishjam expo plugin', 'FishjamProvider mobile', 'useCameraPermissions', 'useMicrophonePermissions', 'useForegroundService', 'useCallKit', 'useCallKitEvent', 'useCallKitService', 'RTCView', 'RTCPIPView', 'ScreenCapturePickerView', 'startPIP', 'stopPIP', 'AudioDeviceType', 'useAudioOutput', '@fishjam-cloud/react-native-webrtc', 'fishjam react native', 'expo fishjam', 'fishjam ios', 'fishjam android', 'broadcast extension'. Re-exports @fishjam-cloud/react-client hooks plus mobile-only: permissions, foreground service, iOS broadcast extension, audio routing, CallKit, Expo config plugin.
tools
Browser-only React SDK for Fishjam — joining rooms, capturing camera/microphone/screen, displaying peers, and acting as a livestream streamer or viewer in a React web app. Use whenever the user is writing a React app in a browser that calls Fishjam APIs, sets up FishjamProvider, or uses any Fishjam React hook. Trigger on: '@fishjam-cloud/react-client', 'FishjamProvider', 'useConnection', 'useCamera', 'useMicrophone', 'useScreenShare', 'usePeers', 'useDataChannel', 'useVAD', 'useLivestreamStreamer', 'useLivestreamViewer', 'useCustomSource', 'useInitializeDevices', 'useUpdatePeerMetadata', 'useSandbox', 'PeerWithTracks', 'joinRoom', 'peerToken', 'fishjamId', 'fishjam react', '@fishjam-cloud/ts-client', 'FishjamClient ts-client'. Covers the provider, the full hook catalog, simulcast configuration, custom sources, data channels, VAD, livestream WHEP playback, device persistence, and reconnection. Briefly notes when to drop down to @fishjam-cloud/ts-client for non-React or worker contexts.