-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection close or set NULL using Request connection #1034
Comments
The $connection = $req->connection;
$connection->send( (new Response(200, ...);
$callback = function ($row) use ($connection) {
$connection->send( new Chunk( implode(',', (array) $row) ) );
}; |
Great, changing as you suggest it works that part. But I'm facing this, once the process sending chunk's has finished, I doing this: $callback = function ($row) use ($connection) {
$connection->send( new Chunk( implode(',', (array) $row) ) );
};
$result = $bo->{$report}(QueryRequest::getInstance($req), $callback);
return (new Response(200))->withBody( new Chunk('') ); But, the browser is detecting a failed and abort the download, as you can see in this image: the return line could be the problem?, I'm doing this, because I need to return a Any suggestion? Thanks |
Well, I solved it, just changed like this: $callback = function ($row) use ($connection) {
$connection->send( new Chunk( implode(',', (array) $row)."\n" ) );
};
$result = $bo->{$report}(QueryRequest::getInstance($req), $callback);
$connection->send( new Chunk('') );
return new Response(200); Thanks anyway! |
Hi, I'm developing a web service using th HTTP protocol and want to send a file using chunks
My code is:
but when a callback is executed and try to use the connection inside request I getting this error:
Worker[28498] process terminated with ERROR: E_ERROR "Call to a member function send() on a non-object
Am I doing something wrong? How can I send chunked part of a file (creating a CSV comming from database)
Hope you can give a glance! thanks.
The text was updated successfully, but these errors were encountered: