{"action":"created","issue":{"url":"https://api.github.com/repos/reactphp/http/issues/79","repository_url":"https://api.github.com/repos/reactphp/http","labels_url":"https://api.github.com/repos/reactphp/http/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/reactphp/http/issues/79/comments","events_url":"https://api.github.com/repos/reactphp/http/issues/79/events","html_url":"https://github.com/reactphp/http/issues/79","id":189407119,"number":79,"title":"Question: What is the right way to send huge content or live stream content?","user":{"login":"thestanislav","id":1858311,"avatar_url":"https://avatars.githubusercontent.com/u/1858311?v=3","gravatar_id":"","url":"https://api.github.com/users/thestanislav","html_url":"https://github.com/thestanislav","followers_url":"https://api.github.com/users/thestanislav/followers","following_url":"https://api.github.com/users/thestanislav/following{/other_user}","gists_url":"https://api.github.com/users/thestanislav/gists{/gist_id}","starred_url":"https://api.github.com/users/thestanislav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thestanislav/subscriptions","organizations_url":"https://api.github.com/users/thestanislav/orgs","repos_url":"https://api.github.com/users/thestanislav/repos","events_url":"https://api.github.com/users/thestanislav/events{/privacy}","received_events_url":"https://api.github.com/users/thestanislav/received_events","type":"User","site_admin":false},"labels":[{"id":4772705,"url":"https://api.github.com/repos/reactphp/http/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-15T14:32:42Z","updated_at":"2016-11-15T18:43:36Z","closed_at":"2016-11-15T16:29:16Z","body":"Seems above code does not work as I expect.\r\nHow can force flush the content to the browser.\r\n\r\n```php\r\n$loop = React\\EventLoop\\Factory::create();\r\n$socket = new React\\Socket\\Server($loop);\r\n\r\n$http = new React\\Http\\Server($socket);\r\n$http->on('request', function ($request, $response) {\r\n    $response->writeHead(200, array('Content-Type' => 'video/mp4'));\r\n    $fp = fopen('Path/to/some/real/big/video.mp4', 'r');\r\n    while (!feof($fp)) {\r\n        $response->write(fread($fp, 1024 * 10));\r\n    }\r\n    fclose($fp);\r\n\r\n    $response->end();\r\n});\r\n\r\n$socket->listen(1337);\r\n$loop->run();\r\n```"},"comment":{"url":"https://api.github.com/repos/reactphp/http/issues/comments/260728914","html_url":"https://github.com/reactphp/http/issues/79#issuecomment-260728914","issue_url":"https://api.github.com/repos/reactphp/http/issues/79","id":260728914,"user":{"login":"thestanislav","id":1858311,"avatar_url":"https://avatars.githubusercontent.com/u/1858311?v=3","gravatar_id":"","url":"https://api.github.com/users/thestanislav","html_url":"https://github.com/thestanislav","followers_url":"https://api.github.com/users/thestanislav/followers","following_url":"https://api.github.com/users/thestanislav/following{/other_user}","gists_url":"https://api.github.com/users/thestanislav/gists{/gist_id}","starred_url":"https://api.github.com/users/thestanislav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thestanislav/subscriptions","organizations_url":"https://api.github.com/users/thestanislav/orgs","repos_url":"https://api.github.com/users/thestanislav/repos","events_url":"https://api.github.com/users/thestanislav/events{/privacy}","received_events_url":"https://api.github.com/users/thestanislav/received_events","type":"User","site_admin":false},"created_at":"2016-11-15T18:43:36Z","updated_at":"2016-11-15T18:43:36Z","body":"Hi, @clue . Can you help me with more descriptive example?\r\n```php\r\n$http->on('request', function ($request, $response)  use($loop)  {\r\n    $response->writeHead(200, array('Content-Type' => 'video/mp4'));\r\n    $fp = fopen('Path/to/some/real/big/video.mp4', 'r');\r\n    \r\n    $source = new Stream($fp, $loop);\r\n    $source->pipe($response);\r\n\r\n    fclose($fp);\r\n    $response->end();\r\n});\r\n```\r\n\r\nWhat I am missing?"}}
{"actor":{"display_login":"thestanislav"}}