Skip to content

Convert broadcast stream to single-subscriber for buffering #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 3, 2018

Conversation

DanTup
Copy link
Contributor

@DanTup DanTup commented Oct 3, 2018

When pausing/unpausing the websocket stream, messages are dropped. This creates a new stream that listens to the websocket stream and just relays messages (but messages will be buffered in the StreamController).

Fixes #34.

When pausing/unpausing the websocket stream, messages are dropped. This creates a new stream that listens to the websocket stream and just relays messages (but messages will be buffered in the StreamController).

Fixes #34.
@DanTup DanTup requested a review from devoncarew October 3, 2018 14:06
Copy link
Member

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

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

lgtm! Good find :)

lib/service.dart Outdated
@@ -196,3 +196,16 @@ class IsolateManager {
return isolates.isEmpty ? null : isolates.first;
}
}

/// Wraps a broadcast stream as a single-subscription stream to workaround
/// events being dropped for DOM/WebSocker broadcast streams when paused
Copy link
Member

Choose a reason for hiding this comment

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

sp: WebSocket

lib/service.dart Outdated
/// events being dropped for DOM/WebSocker broadcast streams when paused
/// (such as in an asyncMap).
/// https://github.com/dart-lang/sdk/issues/34656
Stream<T> wrapStream<T>(Stream<T> stream) {
Copy link
Member

Choose a reason for hiding this comment

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

convertBroadcastToSingleSubscriber() (or similar)?

@DanTup DanTup merged commit d192ff1 into flutter:master Oct 3, 2018
@DanTup DanTup deleted the fix-dropped-messages branch October 3, 2018 16:19
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.

2 participants