Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/pusher/NWWebSocket/compare/0.5.9...HEAD)
## [Unreleased](https://github.com/pusher/NWWebSocket/compare/0.5.10...HEAD)

## [0.5.10](https://github.com/pusher/NWWebSocket/compare/0.5.9...0.5.10) - 2026-03-03

### Fixed

- Treat any POSIX error as a disconnection to handle ENODATA (96) and other unrecognised codes that leave the connection in a zombie state

## [0.5.9](https://github.com/pusher/NWWebSocket/compare/0.5.8...0.5.9) - 2025-12-05

Expand Down
2 changes: 1 addition & 1 deletion NWWebSocket.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'NWWebSocket'
s.version = '0.5.9'
s.version = '0.5.10'
s.summary = 'A WebSocket client written in Swift, using the Network framework from Apple'
s.homepage = 'https://github.com/pusher/NWWebSocket'
s.license = 'MIT'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '14.0'
use_frameworks!

pod 'NWWebSocket', '~> 0.5.9'
pod 'NWWebSocket', '~> 0.5.10'
```

Then, run the following command:
Expand Down Expand Up @@ -90,7 +90,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/pusher/NWWebSocket.git",
.upToNextMajor(from: "0.5.9")),
.upToNextMajor(from: "0.5.10")),
],
targets: [
.target(
Expand Down
5 changes: 5 additions & 0 deletions Sources/NWWebSocket/Model/Client/NWWebSocket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ open class NWWebSocket: WebSocketConnection {
// Only schedule disconnection if we haven't already scheduled one
if isDisconnectionNWError(error) && disconnectionWorkItem == nil {
let reasonData = "The websocket disconnected unexpectedly".data(using: .utf8)
// Cancel the zombie connection to ensure reconnect creates a fresh NWConnection
connection?.cancel()
scheduleDisconnectionReporting(closeCode: .protocolCode(.goingAway),
reason: reasonData)
}
Expand Down Expand Up @@ -559,6 +561,9 @@ open class NWWebSocket: WebSocketConnection {
|| code == .ENETDOWN
|| code == .ECONNABORTED {
return true
} else if case .posix(_) = error {
// Catch-all for other POSIX errors (e.g. ENODATA) that also indicate a dead connection
return true
} else {
return false
}
Expand Down