feat: Fix WebSocket connection issues after account registration by ensuring connection before authentication

This commit is contained in:
k1ngsterr1
2026-01-11 16:19:44 +05:00
parent 5f21f120f1
commit 70ed7fbc6e
4 changed files with 89 additions and 2 deletions

View File

@@ -175,7 +175,13 @@ class AuthStateManager(
loadAccounts()
// Step 8: Authenticate with protocol
// Step 8: Connect and authenticate with protocol
Log.d(TAG, "🌐 Connecting to protocol server...")
ProtocolManager.connect()
// Give WebSocket time to connect before authenticating
kotlinx.coroutines.delay(500)
Log.d(TAG, "🌐 Authenticating with protocol server...")
ProtocolManager.authenticate(keyPair.publicKey, privateKeyHash)
@@ -236,7 +242,13 @@ class AuthStateManager(
status = AuthStatus.Authenticated(decryptedAccount)
)}
// Authenticate with protocol
// Connect and authenticate with protocol
Log.d(TAG, "🌐 Connecting to protocol server...")
ProtocolManager.connect()
// Give WebSocket time to connect before authenticating
kotlinx.coroutines.delay(500)
Log.d(TAG, "🌐 Authenticating with protocol server...")
ProtocolManager.authenticate(decryptedAccount.publicKey, decryptedAccount.privateKeyHash)