nsqjs icon indicating copy to clipboard operation
nsqjs copied to clipboard

Promise/async support?

Open icetbr opened this issue 7 years ago • 2 comments

Hi there, I wonder if there is a specific reason to not use promises to enable await/async ? Would you recommend against a lib such as https://github.com/GeekBerry/nsqjs-promise?

Thanks

icetbr avatar Mar 20 '19 16:03 icetbr

I think it makes sense to support async on some of the methods just as connect, close or publish. However, it doesn't make sense for receiving messages since it's not a single return that you're waiting on. Events are a much better fit in that situation.

dudleycarr avatar Mar 20 '19 16:03 dudleycarr

Good to know, thanks. Those were the ones I currently wanted to promisify, together with the 'ready' event.

icetbr avatar Mar 20 '19 19:03 icetbr