Skip to content

Commit 0c0873a

Browse files
authored
fix: send client close frame (aws-amplify#39)
* fix: send client close frame * tmp: update amplify swift dependency to fix branch * dont send close frame on successful completion * add new close method in test mock * update amplify swift dep version
1 parent 18c23bf commit 0c0873a

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

Package.resolved

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
"kind" : "remoteSourceControl",
66
"location" : "https://github.com/aws-amplify/amplify-swift",
77
"state" : {
8-
"revision" : "4241439bae1662134f0a73bd87c84f7384ffabb6",
9-
"version" : "2.11.0"
8+
"revision" : "bb69fc1febc23dfc539531ce7dd3b51cdf97d813",
9+
"version" : "2.14.1"
1010
}
1111
},
1212
{
1313
"identity" : "amplify-swift-utils-notifications",
1414
"kind" : "remoteSourceControl",
1515
"location" : "https://github.com/aws-amplify/amplify-swift-utils-notifications.git",
1616
"state" : {
17-
"revision" : "d4fd3c17e8d40efc821f448d3d6cff75b8f3b0dd",
18-
"version" : "1.0.0"
17+
"revision" : "f970384ad1035732f99259255cd2f97564807e41",
18+
"version" : "1.1.0"
1919
}
2020
},
2121
{

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let package = Package(
1313
targets: ["FaceLiveness"]),
1414
],
1515
dependencies: [
16-
.package(url: "https://github.com/aws-amplify/amplify-swift", from: "2.11.0")
16+
.package(url: "https://github.com/aws-amplify/amplify-swift", from: "2.14.1")
1717
],
1818
targets: [
1919
.target(

Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ public struct FaceLivenessDetectorView: View {
170170
isPresented = false
171171
onCompletion(.success(()))
172172
case .encounteredUnrecoverableError(let error):
173+
viewModel.livenessService.closeSocket(with: .normalClosure)
173174
isPresented = false
174175
onCompletion(.failure(mapError(error)))
175176
default:

Tests/FaceLivenessTests/MockLivenessService.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class MockLivenessService {
2020
var onVideoEvent: (LivenessEvent<VideoEvent>, Date) -> Void = { _, _ in }
2121
var onInitializeLivenessStream: (String, String) -> Void = { _, _ in }
2222
var onServiceException: (FaceLivenessSessionError) -> Void = { _ in }
23+
var onCloseSocket: (URLSessionWebSocketTask.CloseCode) -> Void = { _ in }
2324
}
2425

2526
extension MockLivenessService: LivenessService {
@@ -61,4 +62,9 @@ extension MockLivenessService: LivenessService {
6162
) {
6263
interactions.append(#function)
6364
}
65+
66+
func closeSocket(with code: URLSessionWebSocketTask.CloseCode) {
67+
interactions.append(#function)
68+
onCloseSocket(code)
69+
}
6470
}

0 commit comments

Comments
 (0)