{"action":"created","issue":{"url":"https://api.github.com/repos/meganz/sdk/issues/510","repository_url":"https://api.github.com/repos/meganz/sdk","labels_url":"https://api.github.com/repos/meganz/sdk/issues/510/labels{/name}","comments_url":"https://api.github.com/repos/meganz/sdk/issues/510/comments","events_url":"https://api.github.com/repos/meganz/sdk/issues/510/events","html_url":"https://github.com/meganz/sdk/issues/510","id":198736438,"number":510,"title":"Flow control with MegaApi::startStreaming","user":{"login":"connesc","id":1195681,"avatar_url":"https://avatars.githubusercontent.com/u/1195681?v=3","gravatar_id":"","url":"https://api.github.com/users/connesc","html_url":"https://github.com/connesc","followers_url":"https://api.github.com/users/connesc/followers","following_url":"https://api.github.com/users/connesc/following{/other_user}","gists_url":"https://api.github.com/users/connesc/gists{/gist_id}","starred_url":"https://api.github.com/users/connesc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connesc/subscriptions","organizations_url":"https://api.github.com/users/connesc/orgs","repos_url":"https://api.github.com/users/connesc/repos","events_url":"https://api.github.com/users/connesc/events{/privacy}","received_events_url":"https://api.github.com/users/connesc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-01-04T15:37:51Z","updated_at":"2017-01-04T16:26:13Z","closed_at":null,"body":"Hi,\r\n\r\nI plan to use `MegaApi::startStreaming` from the intermediate layer.\r\nHowever, I wonder how I can control the download speed.\r\n\r\nMy use case involves multiple download streams that are consumed at different rates, including rather low rates.\r\nSince the downloaded files are large, it is not an option to buffer them at full speed for a later use.\r\nIdeally, I would like each transfer to independently adjust its speed to its consumption rate.\r\n\r\nIs this possible?\r\n\r\nMy first idea was to block the `MegaTransferListener::onTransferUpdate` callback until the consumer is ready to handle more input. Is this correct?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/meganz/sdk/issues/comments/270414473","html_url":"https://github.com/meganz/sdk/issues/510#issuecomment-270414473","issue_url":"https://api.github.com/repos/meganz/sdk/issues/510","id":270414473,"user":{"login":"sergiohs84","id":11694066,"avatar_url":"https://avatars.githubusercontent.com/u/11694066?v=3","gravatar_id":"","url":"https://api.github.com/users/sergiohs84","html_url":"https://github.com/sergiohs84","followers_url":"https://api.github.com/users/sergiohs84/followers","following_url":"https://api.github.com/users/sergiohs84/following{/other_user}","gists_url":"https://api.github.com/users/sergiohs84/gists{/gist_id}","starred_url":"https://api.github.com/users/sergiohs84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergiohs84/subscriptions","organizations_url":"https://api.github.com/users/sergiohs84/orgs","repos_url":"https://api.github.com/users/sergiohs84/repos","events_url":"https://api.github.com/users/sergiohs84/events{/privacy}","received_events_url":"https://api.github.com/users/sergiohs84/received_events","type":"User","site_admin":false},"created_at":"2017-01-04T16:26:13Z","updated_at":"2017-01-04T16:26:13Z","body":"Hi Cédrin\r\n\r\nAt first glance, you can use `MegaApi::startStreaming`. However, you won't be able to limit the speed for each transfer independently, but globally for every on-going download. It means that, for your use case, you will need one instance of `MegaApi` per transfer, which is probably not doable in terms of performance.\r\n\r\nOur recommendation is to use the HTTP server feature integrated in the SDK. You can implement the flow control for the HTTP connection. In example, you may have a thread per connection and block them according to your needs.\r\n\r\nhttps://github.com/meganz/sdk/blob/master/include/megaapi.h#L7881\r\n\r\nHope it helps you and fulfills your needs to develop your apps.\r\n\r\nBest regards"}}
{"actor":{"display_login":"sergiohs84"}}