{"action":"created","issue":{"url":"https://api.github.com/repos/jpaulm/jsfbp/issues/25","labels_url":"https://api.github.com/repos/jpaulm/jsfbp/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/jpaulm/jsfbp/issues/25/comments","events_url":"https://api.github.com/repos/jpaulm/jsfbp/issues/25/events","html_url":"https://github.com/jpaulm/jsfbp/issues/25","id":59412245,"number":25,"title":"Back pressure","user":{"login":"kenhkan","id":1072977,"avatar_url":"https://avatars.githubusercontent.com/u/1072977?v=3","gravatar_id":"","url":"https://api.github.com/users/kenhkan","html_url":"https://github.com/kenhkan","followers_url":"https://api.github.com/users/kenhkan/followers","following_url":"https://api.github.com/users/kenhkan/following{/other_user}","gists_url":"https://api.github.com/users/kenhkan/gists{/gist_id}","starred_url":"https://api.github.com/users/kenhkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenhkan/subscriptions","organizations_url":"https://api.github.com/users/kenhkan/orgs","repos_url":"https://api.github.com/users/kenhkan/repos","events_url":"https://api.github.com/users/kenhkan/events{/privacy}","received_events_url":"https://api.github.com/users/kenhkan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-03-01T19:01:54Z","updated_at":"2015-03-04T14:39:43Z","closed_at":null,"body":"@tlrobinson @ComFreek \r\n\r\nI've been trying to tackle back pressure in my fork, and I must say I'm hitting a dead-end and it'd be nice to hear your thoughts on this.\r\n\r\nTake a look at [this gist](https://gist.github.com/kenhkan/420daef88998e7b95b26). Replace the content of `recvr.js` on [@ComFreek 's fork](https://github.com/ComFreek/jsfbp/tree/streams-impl) and run `fbptest01.js`. You should see something similar to [this](https://gist.github.com/kenhkan/15fa1a56dfdbd16924ef). The timing doesn't matter, but (correct me if I'm wrong please @jpaulm ) the copier should stop after the 5th copy is sent, because of a capacity of 5 set on the connetion between copier and recvr.\r\n\r\nI know that @ComFreek might not have gotten to that point in his fork. Me neither. But the issue is that it seems to be rather difficult in JS (at least with ES5 as that was my thesis).\r\n\r\nWith generators, the control flow is inverted here so there doesn't seem to be an obvious way to have the callee of yield to suspend, or continue to suspend, the caller (in this case, the FBP process). In this particular case, `yield` is returned a bluebird promise but `Promise.coroutine()` would continue the generator as soon as `receive` settles, which it must do. I haven't put too much thought into this problem in a streams-based solution, but I suspect that it's a similar situation.\r\n\r\nAny idea on this problem?"},"comment":{"url":"https://api.github.com/repos/jpaulm/jsfbp/issues/comments/77168623","html_url":"https://github.com/jpaulm/jsfbp/issues/25#issuecomment-77168623","issue_url":"https://api.github.com/repos/jpaulm/jsfbp/issues/25","id":77168623,"user":{"login":"kenhkan","id":1072977,"avatar_url":"https://avatars.githubusercontent.com/u/1072977?v=3","gravatar_id":"","url":"https://api.github.com/users/kenhkan","html_url":"https://github.com/kenhkan","followers_url":"https://api.github.com/users/kenhkan/followers","following_url":"https://api.github.com/users/kenhkan/following{/other_user}","gists_url":"https://api.github.com/users/kenhkan/gists{/gist_id}","starred_url":"https://api.github.com/users/kenhkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenhkan/subscriptions","organizations_url":"https://api.github.com/users/kenhkan/orgs","repos_url":"https://api.github.com/users/kenhkan/repos","events_url":"https://api.github.com/users/kenhkan/events{/privacy}","received_events_url":"https://api.github.com/users/kenhkan/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T14:39:43Z","updated_at":"2015-03-04T14:39:43Z","body":"Got it. That makes sense. It sounds like your second approach is more fundamentally sound. And yes, I'm pretty sure for FBP semantics to work you'd need explicit acks.\r\n\r\n@jpaulm Any insight on a network protocol for FBP?"}}