robosats icon indicating copy to clipboard operation
robosats copied to clipboard

Add REST API endpoint for the trade chat (Turtle mode chat)

Open Reckless-Satoshi opened this issue 3 years ago • 1 comments
trafficstars

Is your feature request related to a problem? Please describe. The Tor network is under attack for the last 15 days. When the network becomes very slow, the chat WebSockets is unstable and hardly hardly usable. However, real time chatting works great, is a good UX and must be kept. As an alternative to TOR and its recent slow downs, an I2P mirror of RoboSats is on the making (https://github.com/Reckless-Satoshi/robosats/commit/131fa0fb99df868bb6ae8d1f7f69ed0930566430 example I2P mirror for the dev site), yet, the websocket chat is also somewhat broken when using the I2P mirror (users can receive messages but not send: the cause of this issue is known).

Describe the solution you'd like It would be great if users can send messages on a POST request and fetch new messages with a GET request. We can call this "Turtle mode chat". It should be possible to enable it on the EncryptedChat.js component and be fully toggleable (on/off) seamlessly with the WebSockets implementation. It could poll the server every 30s for new messages.

This feature also requires some re-writting of the current chat/consumers.py . Since a message sent via REST has to be detected and sent via Websocket to the counterpart.

Describe alternatives you've considered There isn't really any other alternative when it comes to increase the reliability of the chat communication.

Additional context A REST API endpoint to chat with your counterpart will also make it very easy to implement third party trading apps that use the RoboSats API (no need to implement a WebSockets pipeline only for the chat).

The frontend could detect whether "i2p" is part of the domain. If it is, Turtle mode chat can be enabled by default.

Reckless-Satoshi avatar Jun 27 '22 17:06 Reckless-Satoshi

Since the I2P site websocket has been fixed and works flawlessly this task priority is now very low.

Reckless-Satoshi avatar Jul 19 '22 10:07 Reckless-Satoshi