Skip to content

[FCE-3270] fix(ts-client): serialize receiveMediaEvent calls#528

Closed
Critteros wants to merge 4 commits into
fishjam-cloud:mainfrom
Critteros:fix/serialize-receive-media-event
Closed

[FCE-3270] fix(ts-client): serialize receiveMediaEvent calls#528
Critteros wants to merge 4 commits into
fishjam-cloud:mainfrom
Critteros:fix/serialize-receive-media-event

Conversation

@Critteros

Copy link
Copy Markdown
Contributor

Description

Serialize receiveMediaEvent calls in FishjamClient by chaining them through a single promise (receiveMediaEventChain). Each incoming server media event waits for the previous one to settle before
being passed to webrtc.receiveMediaEvent. The chain is reset on disconnect.

Motivation and Context

Server media events were dispatched to the WebRTC layer the moment they arrived, with no ordering guarantee between handlers. When receiveMediaEvent did asynchronous work, concurrent events could
interleave and produce out-of-order state updates. Chaining ensures events are applied in the order they were received.

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)

Critteros and others added 2 commits May 6, 2026 13:55
Chain receiveMediaEvent invocations through a single promise so
incoming server media events are processed in order. Prevents
race when multiple events arrive concurrently. Chain reset on
disconnect
Comment thread packages/ts-client/src/FishjamClient.ts Outdated
Co-authored-by: adrian <33912477+czerwiukk@users.noreply.github.com>

@MiloszFilimowski MiloszFilimowski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we already have a similar queue in webRTCEndpoint.ts so this won't solve the issue.

@MiloszFilimowski

Copy link
Copy Markdown
Collaborator

we already have a similar queue in webRTCEndpoint.ts so this won't solve the issue.

@Critteros Critteros deleted the fix/serialize-receive-media-event branch May 8, 2026 09:28
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.

3 participants