mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-29 19:43:23 +02:00
creates a separate okhttp for relays
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user