-
Notifications
You must be signed in to change notification settings - Fork 4
Message received only once? #11
Comments
I believe the issue might be here since ID coming generated on companion is always the same int this case - seed, the condition is true only once. |
@ygalanter the ID is supposed to be updated for each newly enqueued message: Lines 66 to 73 in ca73637
@Artaud do you want to take a look at this and see what might be going on? |
It looks like when there's nothing in the queue (guess it happens when all messages sent?) it returns the seed. |
I think we need to move line 5 to line 71 so a new seed is generated every time the queue is emptied. I'll submit a fix in a few minutes. |
I added a test and confirmed the behavior. @Artaud if you pull the latest from GitHub you can run the test and see. The message is sent the first time you change the input text in the settings view but messages are not sent for subsequent changes. Unfortunately, I need to jump over to another project so I don't have time right now to finish troubleshooting. I'll revisit in the next couple days if @Artaud hasn't addressed it by then. |
Thanks for spotting this! We can't just generate a new random seed whenever the queue empties up. We still need the message IDs to be incremental, since we check if the last received ID is greater than the previous (on Line 157 in 8818c74
So either we need to ensure that the newly generated seed is greater than the previousy generated, or we can simply remember the last generated ID. This is a little tricky considering that we can have the queue persistent from previous session. So cases are:
I got a PR |
@ygalanter, version 1.1.1 is now available via npm. I added a basic test which now passes thanks to the PR made by @Artaud. I'll close this for now but please feel free to re-open or create a new issue if you run into anything else! |
Awesome! Thank you so much for such fast turnaround. |
Not sure if this is an actual issue or if I am doing something wrong (though I've used fitbit-asap in many other projects with no issues). I am sending message from companion to the app on settings change. On the app
asap.onmessage
fires only once, when I change setting the first time. Consecutive changes have no effect on the app even though the message is sent from companion. I think this might've started when I upgraded to SDK 3.1. Any idea what could be the reason?The text was updated successfully, but these errors were encountered: