php: get server streaming status

42 views
Skip to first unread message

mar...@messagebird.com

unread,
Aug 23, 2017, 6:30:01 AM8/23/17
to grpc.io
How do I get the grpc status for a server streaming call? 
I imagine that if there were no errors while iterating all $call->responses() the status is =0. 
But what about other cases? I see that the iteration can throw InvalidArgumentExceptions but this exception has no $code in it. 

For non server streaming calls you can call $call->wait() that will return the status. 

In go for this case you can do 
grpc.Code(err)
when you have the error. 

I can't find anything for php.

Stanley Cheung

unread,
Aug 24, 2017, 2:22:14 PM8/24/17
to mar...@messagebird.com, grpc.io
For server streaming call, you can do $call->getStatus() to get the status object.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/9ff54e1a-e9f6-4b2a-8d8d-02fb97477770%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marcel Corso

unread,
Aug 24, 2017, 2:48:38 PM8/24/17
to Stanley Cheung, grpc.io
Hi Stanley,

I was getting an error when doing $call->getStatus(). It's not happening anymore since I updated to the last pecl version.

Thank you!
--
Best from Amsterdam

Marcel Corso | Senior Engineer


Ready to start building? Check out our developer docs.  

edkre...@gmail.com

unread,
Jul 30, 2019, 11:25:27 AM7/30/19
to grpc.io
Hi,

when can you call the status.
I stream 500 calls to grpc server,
i can do 500 reads on the result, but i only get one status.

I would like to receive a status on each call.

Op donderdag 24 augustus 2017 20:48:38 UTC+2 schreef Marcel Corso:
Hi Stanley,

I was getting an error when doing $call->getStatus(). It's not happening anymore since I updated to the last pecl version.

Thank you!
On Thu, Aug 24, 2017 at 8:21 PM, Stanley Cheung <stanle...@google.com> wrote:
For server streaming call, you can do $call->getStatus() to get the status object.
On Wed, Aug 23, 2017 at 3:30 AM, <mar...@messagebird.com> wrote:
How do I get the grpc status for a server streaming call? 
I imagine that if there were no errors while iterating all $call->responses() the status is =0. 
But what about other cases? I see that the iteration can throw InvalidArgumentExceptions but this exception has no $code in it. 

For non server streaming calls you can call $call->wait() that will return the status. 

In go for this case you can do 
grpc.Code(err)
when you have the error. 

I can't find anything for php.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grp...@googlegroups.com.

To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/9ff54e1a-e9f6-4b2a-8d8d-02fb97477770%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stanley Cheung

unread,
Jul 30, 2019, 4:41:28 PM7/30/19
to edkre...@gmail.com, grpc.io
Hm, unfortunately that's not how the API is designed. But on the other hand, you can augment your proto data structure to add additional status-related data into your stream response object definition.

To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/15834902-ac36-4277-9891-4554a1f04d18%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages