Conversation
When called, waits for all in flight packets to be sent before resolving. Use this to: 1. Send frames exactly in order: ```ts await track.tryPush(/* ... *\/); await track.flush(); await track.tryPush(/* ... *\/); await track.flush(); // ... etc ... ``` 2. Wait for frames to all be delivered before unpublishing a local data track: ```ts await track.tryPush(/* ... *\/); await track.tryPush(/* ... *\/); await track.tryPush(/* ... *\/); // ... etc ... await track.flush(); await track.unpublish(); ```
🦋 Changeset detectedLatest commit: 725d1f3 The changes in this PR will be included in the next version bump. 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 |
size-limit report 📦
|
| protected log: StructuredLogger = log; | ||
|
|
||
| /** Resolves once the data track has sent all pending packets the rtc data channel buffer. */ | ||
| protected flushedFuture = new Future<void, never>(); |
There was a problem hiding this comment.
what should happen to this future if the room disconnects while flushing?
There was a problem hiding this comment.
Good point - I think the two options are rejecting with an error or just resolving it normally. Also I would argue that the better signal might be engine close, not room disconnect, though I think in practice the former should always happen when the latter occurs.
Any thoughts on either of these points before I add this?
There was a problem hiding this comment.
engine close also sounds fine to me!
no strong opinion on whether it should be rejecting or resolving, but something should happen!
…nnect and use this to resolve any pending flushes
…nts works If this isn't set, then an event with an `undefined` payload is indistinguishable from an event not being delivered because buffer.pop() returns T | undefined.
… calls to resolve
When called, waits for all in flight packets to be sent before resolving. Use this to: