o3ma / o3demo

Sample code for a simple echo bot.
GNU General Public License v3.0
9 stars 6 forks source link

Demo stops working after offline message #7

Open kolAflash opened 7 years ago

kolAflash commented 7 years ago

Demo is working fine. Started demo program on my Linux notebook, send two messages from the Android Threema app on my smartphone and receiving answers from the bot.

Saving ID to threema.id
Using ID: 0A1B2C3D
Retrieving ZX9TZZ7P from directory server
Saving addressbook to address.book
Starting session
Sending initial message
Message [001000123456789a] has been acknowledged by the server.
Message [002000123456789] has been acknowledged by the server.

Closing and starting the demo again also worked fine and it continues to answer messages from my smartphone.

Loading ID from threema.id
Using ID: 0A1B2C3D
Loading addressbook from address.book
Starting session
Sending initial message
Message [003000123456789a] has been acknowledged by the server.
Message [004000123456789a] has been acknowledged by the server.

But then I send one message from my smartphone while the demo wasn't running on my computer. An "offline message"! After that, the demo did not receive or answer any more messages.

Loading ID from threema.id
Using ID: 0A1B2C3D
Loading addressbook from address.book
Starting session
Sending initial message

The demo also stopped answering to non-offline-messages.

Only fix/workaround was to delete the file threema.id on my computer and let it generate a new Threema ID.

kolAflash commented 7 years ago

Threema ID is working again in the demo after using the Android Threema app to restore the ID from the threema.id file and receiving the offline-messages from the server.

So it looks like demo can't receive the waiting offline-messages and that - in some way - blocks the demo from receiving further messages.

V-inz commented 7 years ago

I can confirm this -- sort of (on testing code, 2 days ago)

sometimes (rarely!) when starting the demo and there are more (4 for example) offline-messages waiting, there is no receivedMessage-"event" (no new entry in the channel). You can not send and there are no new receivedMessages anymore.

When hard restarting the demo several times, you suddenly get one receivedMessage, which is the latest you sent to the demo. The other (first 3 for example) messages seem to be lost. (On your mobilephone they don't have viewed-state, but the latest does).

V-inz commented 7 years ago

I think this issue is the reason for what kolAflash describes here. Issue #16 on o3ma/o3: you have to receive before you can send