File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
packages/core/useWebSocket Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,7 @@ export function useWebSocket<Data = any>(
221221
222222 ws . onopen = ( ) => {
223223 status . value = 'OPEN'
224+ retried = 0
224225 onConnected ?.( ws ! )
225226 heartbeatResume ?.( )
226227 _sendBuffer ( )
@@ -236,14 +237,17 @@ export function useWebSocket<Data = any>(
236237 delay = 1000 ,
237238 onFailed,
238239 } = resolveNestedOptions ( options . autoReconnect )
239- retried += 1
240240
241- if ( typeof retries === 'number' && ( retries < 0 || retried < retries ) )
241+ if ( typeof retries === 'number' && ( retries < 0 || retried < retries ) ) {
242+ retried += 1
242243 setTimeout ( _init , delay )
243- else if ( typeof retries === 'function' && retries ( ) )
244+ }
245+ else if ( typeof retries === 'function' && retries ( ) ) {
244246 setTimeout ( _init , delay )
245- else
247+ }
248+ else {
246249 onFailed ?.( )
250+ }
247251 }
248252 }
249253
You can’t perform that action at this time.
0 commit comments