Skip to content

Add fishjam hooks to composition package#282

Open
AHGIJMKLKKZNPJKQR wants to merge 12 commits into
mainfrom
fce-3397
Open

Add fishjam hooks to composition package#282
AHGIJMKLKKZNPJKQR wants to merge 12 commits into
mainfrom
fce-3397

Conversation

@AHGIJMKLKKZNPJKQR

@AHGIJMKLKKZNPJKQR AHGIJMKLKKZNPJKQR commented Jun 24, 2026

Copy link
Copy Markdown
Member

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

  • Documentation update required
  • Documentation updated in another PR
  • No documentation update required

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)

@AHGIJMKLKKZNPJKQR AHGIJMKLKKZNPJKQR self-assigned this Jun 24, 2026
@linear

linear Bot commented Jun 24, 2026

Copy link
Copy Markdown

FCE-3397

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() to FishjamWSNotifier, surface trackForwarding* + vadNotification as 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.

Comment thread packages/js-server-sdk/src/notifications.ts
Comment thread packages/composition/src/store.ts
Comment thread packages/composition/src/store.ts
Comment thread packages/composition/src/store.ts Outdated
Comment thread packages/composition/src/store.ts
Comment thread packages/composition/package.json
Comment thread packages/composition/src/eventBus.ts Outdated
Comment thread packages/composition/src/hooks.ts Outdated
Comment thread packages/composition/src/hooks.ts
Comment thread packages/composition/src/store.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants