We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 794335b commit 492dca2Copy full SHA for 492dca2
1 file changed
Sources/NWWebSocket/Model/Client/NWWebSocket.swift
@@ -526,6 +526,8 @@ open class NWWebSocket: WebSocketConnection {
526
// Only schedule disconnection if we haven't already scheduled one
527
if isDisconnectionNWError(error) && disconnectionWorkItem == nil {
528
let reasonData = "The websocket disconnected unexpectedly".data(using: .utf8)
529
+ // Cancel the zombie connection to ensure reconnect creates a fresh NWConnection
530
+ connection?.cancel()
531
scheduleDisconnectionReporting(closeCode: .protocolCode(.goingAway),
532
reason: reasonData)
533
}
0 commit comments