RoboSats / robosats

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

Websockets using Tor on Android #261

Open KoalaSat opened 1 year ago

KoalaSat commented 1 year ago

Is your feature request related to a problem? Please describe. As part of the Android first functional apk, we want to be able to create websockets with the server trough the Tor network.

Describe the solution you'd like Extend ApiWebClient and ApiNativeClient to be used for creating sockets

flowchart LR
    ApiClient <--> ApiWebClient
    ApiClient <--> ApiNativeClient
    ApiNativeClient <--> react-native
    react-native <--> Tor
    Tor <--> ServerSocket
    ApiWebClient <--> ServerSocket

Describe alternatives you've considered On the case it's not possible to create sockets with the Tor library, we discussed to create a CRUD endpoint for this.

Additional context

Reckless-Satoshi commented 1 year ago

we discussed to create a CRUD endpoint for this

This is referring to the only part of the app that is WebSockets only, the chat, right? I link here the relevant thread https://github.com/Reckless-Satoshi/robosats/issues/175

If WebSockets were possible we could create a new notification consumer for push notifications.

Let's make implementing WebSockets over Tor on Android a rewarded task. It is unclear the amount of time and effort needed so let's make it a "range" reward and decide the specific amount as a solution becomes more clearer. ⚡ 400K - 1M Sats ⚡ Shall I assign you?

KoalaSat commented 1 year ago

Shall I assign you?

Sorry I missed the last time this last sentence, yeah, I'll work on it right after we close the persist data issue

KoalaSat commented 1 year ago

ok so bad news, given the actual implementation of react-native-tor websockets are not possible. They implemented a TCP connection for an specific request made by Bluewallet, but their goal was to use it to connect to Electrum. I was too ingenious to believe a websocket was just a TCP connection with steroids, it's not, and this post explains it very well https://stackoverflow.com/questions/14928222/tcp-socket-to-websocket