Skip to content

Commit 08412e8

Browse files
authored
fix(useWebSocket): autoreconnect when ws close (#4314)
1 parent 1d661f9 commit 08412e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/core/useWebSocket/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export function useWebSocket<Data = any>(
231231
status.value = 'CLOSED'
232232
onDisconnected?.(ws, ev)
233233

234-
if (!explicitlyClosed && options.autoReconnect && ws === wsRef.value) {
234+
if (!explicitlyClosed && options.autoReconnect && (wsRef.value == null || ws === wsRef.value)) {
235235
const {
236236
retries = -1,
237237
delay = 1000,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy