-
Notifications
You must be signed in to change notification settings - Fork 50
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
Make client Async-Iterable #6
Comments
Maybe we should do mqtt@3 and integrate promises there too. |
Would it mean a total overhaul of mqtt to use promises internally, or just make the methods that take callbacks optionally return promises? |
I think integrating promises with the main mqtt library would be very great. Mongoose does exactly what @RangerMauve said. Making methods that take callbacks and optionally return promises. |
Yes, that'd be my idea. |
Should I hold off on adding the Async-Iteration until that's done, or would it be good to add it here first so that we can play around with the implementation for when we add it to the main mqtt lib? |
Hey, I would like to mention a few things. At first, why would you say a dream would come true, to have asyncIterators, while still being able to do stuff without them? The proposal is still not finished, by the way. I can only say, that I was at the same position, but then all of sudden, we had a huge memory-leak problem in production. on a real big project. Investing days with digging in memory-heap-dumps... seeing parts of async iterator in the dumps. Issues on Github occured. A lot of hazzle. Things can quickly get complex and hopefully anyone is there, who understands that iterator code then.
Sry, for the strong words. I only wanted to give constructive feedback. Cheers! |
Seems to work perfectly fine for me. |
Since Async Iteration is on the cusp of being available everywhere, the following dream code could become a reality:
I propose we detect whether the environment has a
Symbol.asyncIterator
defined, and it it does, define a method for making the client async-iterable.The text was updated successfully, but these errors were encountered: