carlessistare/grpc-promise

Accessing original callback function

Closed this issue · 5 comments

After promisifying all functions in the RPC, how do I access the original callback function, if I desire to use both promise and callback versions?

** Great library, by the way...

Thanks @chidiwilliams and sorry for the late response.
Yes indeed once you promisify the client instance, you've got no access to the old callback functions, since the client itself is modified.
By now you either create 2 clients in the same project (which is a bit dumb), or propose an update where we duplicate all service functions: one with promise, two with old callback functionality (suffixed by 'Old').

Thanks @carlessistare. I'll propose having duplicates of the service functions with a prefix or suffix.

Hi @chidiwilliams I am currently working on a PR for promisify one single function of the grpc service, for the use cases where promisifyAll is not necessary.
I hope it would help, so you could have a function with callback and the other with promise.
It'll be done in a couple of days and I'll resolve this issue then.
Keep you posted

That'd be great!

@chidiwilliams PR #7 fixes this issue