We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When unsubscribe from grpc client call unary method with client streaming data, it does nothing, so:
public createUnaryServiceMethod( client: any, methodName: string, ): (...args: any[]) => Observable<any> { return (...args: any[]) => { const isRequestStream = client[methodName].requestStream; const upstreamSubjectOrData = args[0]; const isUpstreamSubject = upstreamSubjectOrData && isFunction(upstreamSubjectOrData.subscribe); if (isRequestStream && isUpstreamSubject) { return new Observable(observer => { let isClientCanceled = false; const callArgs = [ (error: any, data: unknown) => { if (error) { if (error.details === GRPC_CANCELLED) { call.destroy(); if (isClientCanceled) { return; } } return observer.error(this.serializeError(error)); } observer.next(data); observer.complete(); }, ]; const maybeMetadata = args[1]; if (maybeMetadata) { callArgs.unshift(maybeMetadata); } const call = client[methodName](...callArgs); const upstreamSubscription: Subscription = upstreamSubjectOrData.subscribe( (val: unknown) => call.write(val), (err: unknown) => call.emit('error', err), () => call.end(), ); return () => { upstreamSubscription.unsubscribe(); if (!call.finished) { isClientCanceled = true; call.cancel(); } }; }); } return new Observable(observer => { const call = client[methodName](...args, (error: any, data: any) => { if (error) { return observer.error(this.serializeError(error)); } observer.next(data); observer.complete(); }); return () => { if (!call.finished) { call.cancel(); } }; }); }; }
The code update may be look like that. I'm trying in my PC and seem it work.
Allow client cancel request
The text was updated successfully, but these errors were encountered:
Let's track this here #12026
Sorry, something went wrong.
No branches or pull requests
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
When unsubscribe from grpc client call unary method with client streaming data, it does nothing, so:
Describe the solution you'd like
Teachability, documentation, adoption, migration strategy
The code update may be look like that. I'm trying in my PC and seem it work.
What is the motivation / use case for changing the behavior?
Allow client cancel request
The text was updated successfully, but these errors were encountered: