-
Notifications
You must be signed in to change notification settings - Fork 764
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
Missing cleanup prototype functions #292
Comments
That's a fair point. Looks like gRPC Node's implementation uses |
* grpcweb: Support grpc-web-text content-type Adds support for the application/grpc-web-text content type to the Go proxy. Client support and tests will be added later. Helps grpc#254.
Now there are two cleanup methods, i.e. const stream = client.sayManyHellos(req, {});
stream.on("end", () => {
stream.cancel()
}) Or more explicitly const stream = client.sayManyHellos(req, {});
const onEnd = () => {
stream.removeListener("end", onEnd)
stream.cancel()
}
stream.on("end", onEnd) |
@MihailsKuzmins Thanks for the question! As far as i understand, I haven't tried myself, but i do expect a few last callbacks (like Hope that makes sense :) |
@sampajano thank you for explaining. So as I understood it's better to remove the |
When we register a listener to 'data', 'error' events, the source code is basically overriding existing methods. There is no clean ways to unregister the listener. We'd expect a method such as
off
,removeListener
. Even better, we can useaddListener
to replace current implementation ofon
.https://github.com/grpc/grpc-web/blob/master/javascript/net/grpc/web/grpcwebclientreadablestream.js#L211-L224
To clean up, in current version we have to do this:
stream.on('data', () => {})
The text was updated successfully, but these errors were encountered: