This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23719 - Consider adding pull style flow control method to Stream
Summary: Consider adding pull style flow control method to Stream
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Streams API (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Takeshi Yoshino
QA Contact: public-webapps-bugzilla
Depends on:
Reported: 2013-11-05 07:47 UTC by Takeshi Yoshino
Modified: 2014-01-28 05:26 UTC (History)
2 users (show)

See Also:


Description Takeshi Yoshino 2013-11-05 07:47:48 UTC
It's good to have a method to allow "passive producer" (which doesn't want to do work until the connected consumer requests data) to wait until the consumer requests data.

E.g. random number generator would be categorized into this group.

Consider trade-off between advantage of this feature and inflation of API surface.
Comment 1 Takeshi Yoshino 2013-11-06 06:27:47 UTC
There is a caveat we need to be careful of.

If we allow both
- Producer waiting for N bytes available for write
- Consumer waiting for M bytes available for read
this can result in deadlock.

Cf. bulk transfer, TCP's silly window syndrome issue.
Comment 2 Takeshi Yoshino 2013-11-07 17:28:47 UTC
Split waiting functionality into a separate method waitForWritable(). It's confusing that write() method has that functionality. It doesn't seem to be worth taking that approach for smaller API surface.

For now, include just waitForWritable(undefined). waitForWritable(size) though it might be useful for some cases as explained in Comment 1.
Comment 3 Takeshi Yoshino 2013-11-07 21:17:20 UTC
Done in preview ver

waitForWritable has been added.
Comment 4 Takeshi Yoshino 2014-01-28 05:26:11 UTC
It's in ED now. Named awaitSpaceAvailable().