Skip to content

Commit 175853d

Browse files
authored
chore: kickoff release
2 parents dd68760 + 3c947fc commit 175853d

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ public final class FaceLivenessSession: LivenessService {
5454
serverEventListeners[event] = listener
5555
}
5656

57+
public func closeSocket(with code: URLSessionWebSocketTask.CloseCode) {
58+
websocket.close(with: code)
59+
}
60+
5761
public func initializeLivenessStream(withSessionID sessionID: String, userAgent: String = "") throws {
5862
var components = URLComponents(url: baseURL, resolvingAgainstBaseURL: false)
5963
components?.queryItems = [

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSessionRepresentable.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ public protocol LivenessService {
2525
listener: @escaping (FaceLivenessSession.SessionConfiguration) -> Void,
2626
on event: LivenessEventKind.Server
2727
)
28+
29+
func closeSocket(with code: URLSessionWebSocketTask.CloseCode)
2830
}
2931

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/WebSocketSession.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ final class WebSocketSession {
5656
task?.resume()
5757
}
5858

59-
func close(with code: URLSessionWebSocketTask.CloseCode, reason: Data = .init()) {
60-
task?.cancel(with: code, reason: reason)
59+
func close(with code: URLSessionWebSocketTask.CloseCode?, reason: Data? = nil) {
60+
if let code {
61+
task?.cancel(with: code, reason: reason)
62+
} else {
63+
task?.cancel()
64+
}
6165
}
6266

6367
func send(

0 commit comments

Comments
 (0)