RoboSats / robosats

A simple and private bitcoin exchange
https://learn.robosats.com
GNU Affero General Public License v3.0
689 stars 134 forks source link

Chat delays when in active order #1293

Open Purchase73 opened 3 months ago

Purchase73 commented 3 months ago

Describe the bug Chat delays in an active order

To Reproduce

Steps to reproduce the behavior:

This is in the new apk, v0.6.1-alpha. I'm not sure it can be reproduced, but in an active order, once I got to the 3 of 4 screen (chat with seller), I was able to type a message, but was NOT able to hit send. It was disabled, grayed out. Then all at once, I got a bunch of messages from the other party in the trade, indicating that the other party had been typing messages previously, and I had not been responding. Like "hello?, anyone there" type messages. I was then able to send messages. The trade completed. The whole thing just probably took a couple more minutes than normal, but it's disconcerting to have the chat window open but not be able to send a message.

This has never happened in any other place I've used robosats.

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

Reckless-Satoshi commented 3 months ago

Hey @Purchase73 . Indeed, this is in fact a legacy problem.

Will further explain the causes here in case anyone feels jumping into fixing this one.

The Android app uses the HTTP API of the chatroom. On browser, we use Websockets for instant messaging, but the HTTP API is also available (under the name "Turtle mode" the small icon between the two chat status indicators).

That means in Android the app polls for messages very X seconds. This coordinator endpoint might have some other issues as well that make it slow.

The Android app didn't use the Websockets for instant chatting because that was not possible with our previous Tor library. However, it is likeky that the websockets might work with the new native Tor library @KoalaSat implemented. So this issue might not be too difficult to solve anymore.

Purchase73 commented 3 months ago

FYI - same issue again, second time I tried. When you go to a different screen (like I switch from Order to Robot and back to Order again) it appears to kick-start something, and I get the messages that have been queued up. Otherwise, I don't know if I'd ever get them.