Discussion:
[dart-misc] Introducing stream_channel
'Natalie Weizenbaum' via Dart Misc
2016-01-28 21:21:16 UTC
Permalink
Hey Dartisans,

I just published a new package called stream_channel
<https://pub.dartlang.org/packages/stream_channel> and I want to talk it up
a bit. It fills in a hole in the Dart asynchrony landscape by providing a
standard way of representing two-way communication: the eponymous
StreamChannel
<https://www.dartdocs.org/documentation/stream_channel/1.0.0/stream_channel/StreamChannel-class.html>
class.

The interface itself is extremely simple:

abstract class StreamChannel<T> {
/// The single-subscription stream that emits values from the
/// other endpoint.
Stream<T> get stream;

/// The sink for sending values to the other endpoint.
StreamSink<T> get sink;
}


There are also a few utility methods, but those can easily be implemented
in terms of stream and sink using StreamChannelMixin
<https://www.dartdocs.org/documentation/stream_channel/1.0.0/stream_channel/StreamChannelMixin-class.html>
.

This package will make it easier to deal with two-way communication in a
general way, without being tightly coupled to context-specific APIs like
ReceivePort or WebSocket. I'm planning on migrating packages like
shelf_web_socket <https://pub.dartlang.org/packages/shelf_web_socket> that
handle two-way communication to use StreamChannels very soon.

Enjoy!
- Natalie
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Anders Holmgren
2016-01-29 03:38:53 UTC
Permalink
noice
Post by 'Natalie Weizenbaum' via Dart Misc
Hey Dartisans,
I just published a new package called stream_channel
<https://pub.dartlang.org/packages/stream_channel> and I want to talk it
up a bit. It fills in a hole in the Dart asynchrony landscape by providing
a standard way of representing two-way communication: the eponymous
StreamChannel
<https://www.dartdocs.org/documentation/stream_channel/1.0.0/stream_channel/StreamChannel-class.html>
class.
abstract class StreamChannel<T> {
/// The single-subscription stream that emits values from the
/// other endpoint.
Stream<T> get stream;
/// The sink for sending values to the other endpoint.
StreamSink<T> get sink;
}
There are also a few utility methods, but those can easily be implemented
in terms of stream and sink using StreamChannelMixin
<https://www.dartdocs.org/documentation/stream_channel/1.0.0/stream_channel/StreamChannelMixin-class.html>
.
This package will make it easier to deal with two-way communication in a
general way, without being tightly coupled to context-specific APIs like
ReceivePort or WebSocket. I'm planning on migrating packages like
shelf_web_socket <https://pub.dartlang.org/packages/shelf_web_socket>
that handle two-way communication to use StreamChannels very soon.
Enjoy!
- Natalie
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Continue reading on narkive:
Loading...