Skip to content

Commit

Permalink
make sure message if nil to hit bottom of loop if reconnect is true
Browse files Browse the repository at this point in the history
  • Loading branch information
heckj committed May 10, 2024
1 parent 766fddf commit dd344da
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,12 @@ public final class WebSocketProvider: NetworkProvider {
// error scenario with the WebSocket connection
Logger.websocket.warning("WEBSOCKET: Error reading websocket: \(error.localizedDescription)")
peered = false
msgFromWebSocket = nil
webSocketTask.cancel()
if !config.reconnectOnError {
// if we don't want to attempt to reconnect on error, terminate the retry loop
break
}
try await Task.sleep(for: .seconds(1))
}

if let encodedMessage = msgFromWebSocket {
Expand Down

0 comments on commit dd344da

Please sign in to comment.