livekit / client-sdk-js

LiveKit browser client SDK (javascript)
https://livekit.io
Apache License 2.0
368 stars 149 forks source link

Await data publisher connection with single promise #1107

Closed lukasIO closed 6 months ago

lukasIO commented 6 months ago

We had user reports of maxListeners exceeded when they were using e.g. user input events to trigger data publishing.

This was due to the fact that in those handlers users would typically do something like

document.addEventListener('mousemove', async (ev) => { await room.localParticipant.publishData(...); }

This could trigger multiple negotiation requests while the publisher data connection is establishing as the calls to publishData could be happening in parallel.

To make this easier for users to handle we keep an internal reference to the publisher connection promise and await that.

This PR also updates the @livekit/protocol package to the latest version for some improved tree shaking capabilities.

changeset-bot[bot] commented 6 months ago

🦋 Changeset detected

Latest commit: 711334512f71ba3b6c1393edb0c544eef5ff46b3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------- | ----- | | livekit-client | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

github-actions[bot] commented 6 months ago

size-limit report 📦

Path Size
dist/livekit-client.esm.mjs 78.6 KB (0%)
dist/livekit-client.umd.js 84.14 KB (0%)