Enhance socket connection logging and URL handling

- Added logging for the backend URL in the `runtime_socket_connect` function to improve traceability.
- Updated the `SocketManager` to convert HTTP/HTTPS URLs to WebSocket URLs, enhancing connection handling.
- Improved error logging to capture detailed error chains during connection failures, aiding in debugging.
This commit is contained in:
Steven Enamakel
2026-02-05 20:12:42 +05:30
parent 339334466a
commit 9e678a08a6
3 changed files with 35 additions and 11 deletions
+5 -1
View File
@@ -37,10 +37,14 @@ export async function connectRustSocket(token: string): Promise<void> {
if (!isTauri()) return;
try {
console.log('[TauriSocket] Connecting Rust socket to', BACKEND_URL);
await invoke('runtime_socket_connect', { token, url: BACKEND_URL });
console.log('[TauriSocket] Rust socket connecting');
console.log('[TauriSocket] Rust socket connect call succeeded');
} catch (error) {
console.error('[TauriSocket] Failed to connect Rust socket:', error);
// Ensure Redux status reflects the failure
const uid = getSocketUserId();
store.dispatch(setStatusForUser({ userId: uid, status: 'disconnected' }));
}
}