Add fishjam hooks to composition package#282
Open
AHGIJMKLKKZNPJKQR wants to merge 12 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the SDK’s notification surface to include track-forwarding and VAD events, and introduces a new @fishjam-cloud/composition API built around a room-state store plus React hooks for composition templates.
Changes:
- JS server SDK: add
disconnect()toFishjamWSNotifier, surfacetrackForwarding*+vadNotificationas expected events, and map them into friendlier payloads. - Composition package: add a singleton store/reducer that projects peers + forwarded tracks into “streams”, plus React hooks (
usePeers,usePeer,useRoom,useSpeakingState) to read that state. - Add/adjust tests for the new SDK notifications and composition store/hooks behavior.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Adds React/tooling deps needed for composition hooks/tests. |
| packages/js-server-sdk/src/notifications.ts | Reclassifies forwarding/VAD as expected events and adds payload mapping. |
| packages/js-server-sdk/src/types.ts | Adds VadStatus type. |
| packages/js-server-sdk/src/ws_notifier.ts | Adds disconnect() method to close the socket and stop emitting. |
| packages/js-server-sdk/src/index.ts | Re-exports new notification types. |
| packages/js-server-sdk/tests/notifications.test.ts | Adds tests for forwarding/VAD mapping and event classification. |
| packages/js-server-sdk/tests/webhook.test.ts | Updates ignored/deprecated webhook notification fixture. |
| packages/js-server-sdk/tests/ws_notifier.test.ts | Adds disconnect test and improves WebSocket fake. |
| packages/composition/src/store.ts | Introduces composition room-state store, reducer, snapshot derivation. |
| packages/composition/src/hooks.ts | Adds React hooks backed by useSyncExternalStore. |
| packages/composition/src/types.ts | Defines projected peer/stream/track state types for templates. |
| packages/composition/src/index.ts | Exports hooks/types and keeps event bus export. |
| packages/composition/src/eventBus.ts | Keeps global event bus contract + export. |
| packages/composition/src/internal.ts | Adds internal export surface for store/snapshot types. |
| packages/composition/tests/store.test.ts | Adds reducer/store behavior tests (forwarding, metadata, VAD, etc.). |
| packages/composition/tests/hooks.test.ts | Adds hook-level tests and typing assertions. |
| packages/composition/package.json | Updates package description, exports, build entries, and adds React peer/dev deps. |
Comments suppressed due to low confidence (1)
packages/js-server-sdk/tests/ws_notifier.test.ts:39
- Minor formatting:
const noop = () => { };doesn’t match the formatting used elsewhere in this file and will be rewritten by Prettier.
const noop = () => {};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
czerwiukk
requested changes
Jun 25, 2026
Gawor270
reviewed
Jun 25, 2026
Gawor270
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Export hooks that give access to state of peers and their tracks within in the room. The tracks are mapped to smelter input ids
Opted for storing vad and peers separately, top-level, but I'm open for debate
Motivation and Context
Why is this change required? What problem does it solve? If it fixes an open
issue, please link to the issue here.
Documentation impact
Types of changes
not work as expected)