@@ -28,7 +28,7 @@ export class SocketTransport {
28
28
private hasConnectedOnce : boolean = false
29
29
30
30
private readonly retryConfig : RetryConfig = {
31
- maxInitialAttempts : 10 ,
31
+ maxInitialAttempts : Infinity ,
32
32
initialDelay : 1_000 ,
33
33
maxDelay : 15_000 ,
34
34
backoffMultiplier : 2 ,
@@ -67,12 +67,8 @@ export class SocketTransport {
67
67
await this . connectWithRetry ( )
68
68
} catch ( error ) {
69
69
console . error (
70
- `[SocketTransport] Initial connection attempts failed : ${ error instanceof Error ? error . message : String ( error ) } ` ,
70
+ `[SocketTransport] Unexpected error in connection loop : ${ error instanceof Error ? error . message : String ( error ) } ` ,
71
71
)
72
-
73
- // If we've never connected successfully, we've exhausted our retry attempts
74
- // The user will need to manually retry or fix the issue
75
- this . connectionState = ConnectionState . FAILED
76
72
}
77
73
}
78
74
@@ -83,9 +79,7 @@ export class SocketTransport {
83
79
try {
84
80
this . connectionState = this . retryAttempt === 0 ? ConnectionState . CONNECTING : ConnectionState . RETRYING
85
81
86
- console . log (
87
- `[SocketTransport] Connection attempt ${ this . retryAttempt + 1 } / ${ this . retryConfig . maxInitialAttempts } ` ,
88
- )
82
+ console . log ( `[SocketTransport] Connection attempt ${ this . retryAttempt + 1 } ` )
89
83
90
84
await this . connectSocket ( )
91
85
@@ -111,12 +105,6 @@ export class SocketTransport {
111
105
this . socket = null
112
106
}
113
107
114
- if ( this . retryAttempt >= this . retryConfig . maxInitialAttempts ) {
115
- this . connectionState = ConnectionState . FAILED
116
-
117
- throw new Error ( `Failed to connect after ${ this . retryConfig . maxInitialAttempts } attempts` )
118
- }
119
-
120
108
console . log ( `[SocketTransport] Waiting ${ delay } ms before retry...` )
121
109
122
110
await this . delay ( delay )
@@ -204,10 +192,7 @@ export class SocketTransport {
204
192
this . socket . on ( "reconnect_failed" , ( ) => {
205
193
console . error ( `[SocketTransport] Socket.IO reconnection failed after all attempts` )
206
194
207
- this . connectionState = ConnectionState . FAILED
208
-
209
- // Socket.IO has exhausted its reconnection attempts
210
- // The connection is now permanently failed until manual intervention
195
+ this . connectionState = ConnectionState . RETRYING
211
196
} )
212
197
213
198
this . socket . on ( "error" , ( error ) => {
0 commit comments