Closed tony612 closed 5 years ago
It should return an {error, Reason}
tuple in that case. Doesn't it?
It doesn't. Now it will wait forever or until timeout.
When you say canceled do you mean that you cancel the stream on the client side or that the server cancels the stream?
On the client side, after calling gun:cancel/2
. Of course I know I shouldn't try to send data after canceling, but I want to know the status of the stream in some way.
Ah OK it makes more sense then, I thought you meant the server.
I'm not sure it's possible because gun:await
only does a receive. On the other hand maybe what we can add is a separate function to query a stream's state so that you can know whether an await call will have chances of succeeding.
Yeah, I think adding a function will be a good solution so that we don't need to change how gun:await
behaves.
I've just added gun:stream_info/2
and it will be in 2.0. Closing, thanks!
I want to return an error if
:gun:await/2
is called after the HTTP/2 stream is canceled. Is there any way to achieve this? Like getting the canceled status?