creates a separate okhttp for relays

This commit is contained in:
Vitor Pamplona
2025-08-22 13:35:46 -04:00
parent e0ffa6d4fb
commit f9ea1270fa

View File

@@ -82,7 +82,7 @@ class Amethyst : Application() {
// Service that will run at all times to receive events from Pokey
val pokeyReceiver = PokeyReceiver()
// creates okHttpClients based on the conditions of the connection and tor status
// manages all the other connections separately from relays.
val okHttpClients =
DualHttpClientManager(
userAgent = appAgent,
@@ -92,12 +92,22 @@ class Amethyst : Application() {
scope = applicationIOScope,
)
// manages all relay connections
val okHttpClientForRelays =
DualHttpClientManager(
userAgent = appAgent,
proxyPortProvider = torManager.activePortOrNull,
isMobileDataProvider = connManager.isMobileOrNull,
keyCache = keyCache,
scope = applicationIOScope,
)
val torProxySettingsAnchor = ProxySettingsAnchor()
// Connects the NostrClient class with okHttp
val websocketBuilder =
OkHttpWebSocket.Builder { url ->
okHttpClients.getHttpClient(torProxySettingsAnchor.useProxy(url))
okHttpClientForRelays.getHttpClient(torProxySettingsAnchor.useProxy(url))
}
// Caches all events in Memory