robosats
robosats copied to clipboard
Websockets using Tor on Android
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
-
SystemWebClient
: It contains the actual sockets connection implementation -
SystemNativeClient
: It uses the Native client to create the socket connection. We need to be careful here, so far Native connection has been always initiated on the web app, but this time the message might be (or not) initiated on the server side, so for this case we need to implement a publish-subscribe pattern.
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
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?
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
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