Skip to content

Commit e5c34ab

Browse files
authored
Merge pull request #4 from stairtree/improve-closing-behavior
Indiscriminately close the events channel on task error
2 parents 489c6f9 + 34e6e7a commit e5c34ab

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ To integrate the package:
2626

2727
```swift
2828
dependencies: [
29-
.package(url: "https://github.com/stairtree/StructuredWebSocketClient.git", from: "0.1.0"),
29+
.package(url: "https://github.com/stairtree/StructuredWebSocketClient.git", from: "0.2.0"),
3030
]
3131
```

Sources/StructuredWebSocketClient/URLSession+MessageTransport.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,7 @@ public actor URLSessionWebSocketTransport: MessageTransport, SimpleURLSessionTas
154154
await self.events.send(.failure(nsError))
155155
// If the task is already closed, we need to call onClose, as that is
156156
// the only way the events channel is finished.
157-
if self.wsTask.closeCode != .invalid {
158-
await self.onClose(closeCode: .abnormalClosure, reason: Data(reason.utf8))
159-
}
157+
await self.onClose(closeCode: .abnormalClosure, reason: Data(reason.utf8))
160158
}
161159

162160
private func readNextMessage(_ number: Int) async {

0 commit comments

Comments
 (0)