robhogan / react-native-paho-mqtt

react-native-paho-mqtt
91 stars 32 forks source link

Cleanup message queue after sending them through the socket #3

Closed franleplant closed 7 years ago

franleplant commented 7 years ago

Hi There! This fixes an issue that I detected that messages sent to a particular topic one, where always sent every time you attempted to send another message to that topic, digging through the code and comparing it to the original paho, I found out that the process_queue was not cleaning the queue after sending the messages

robhogan commented 7 years ago

That's a good find - thanks. I guess in a blitz of refactoring I thought reverse() copied the array so didn't realise the significance of the pop().

Looking again though - why don't we just do while (wireMessage = this._messagesAwaitingDispatch.shift())? shift() removes from the beginning of the array, which is exactly what we need without reversing.

franleplant commented 7 years ago

Ok, I've done that, and Im going to be testing it throughout the day, but it should work

franleplant commented 7 years ago

Also, BTW, could we create a new release after this PR is merged? I can help with that too

robhogan commented 7 years ago

LGTM - will push a release up shortly

franleplant commented 7 years ago

Ty!

robhogan commented 7 years ago

0.0.8 is out now ;)

(This lib isn't really production-ready by the way, I'm not even using it myself yet - but good luck!)

franleplant commented 7 years ago

Hi there! That would be nice to have in the Readme. Being all that said, this is the only library I could make work with React Native so cheers about that. I'll be using it for a while so I hope I can help you making it better. Fran

PD: Have you considered open issues? Perhaps we can get more feedback that way

On Wed, Mar 29, 2017 at 11:50 AM Rob Hogan notifications@github.com wrote:

0.0.8 is out now ;)

(This lib isn't really production-ready by the way, I'm not even using it myself yet - but good luck!)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rh389/react-native-paho-mqtt/pull/3#issuecomment-290114720, or mute the thread https://github.com/notifications/unsubscribe-auth/ABxEJ1zVMMH6LcVPShcCCqCpqv7h7F32ks5rqm_CgaJpZM4MsExb .