Skip to content

Commit c94c9d6

Browse files
author
Pramod Prajapati
committed
Added region handling for creating correct streaming endpoint
1 parent 0f72334 commit c94c9d6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,20 @@
77

88
import Foundation
99

10+
private let ISO_PARTITION_BASE_DOMAIN: String = "csp.hci.ic.gov"
11+
private let DEFAULT_BASE_DOMAIN: String = "amazonaws.com"
12+
1013
func streamingSessionURL(for region: String) throws -> URL {
11-
let urlString = "wss://streaming-rekognition.\(region).amazonaws.com/start-face-liveness-session-websocket"
14+
15+
// Determine the base domain based on the region
16+
let baseDomain: String
17+
if region.lowercased().starts(with: "us-isof") {
18+
baseDomain = ISO_PARTITION_BASE_DOMAIN
19+
} else {
20+
baseDomain = DEFAULT_BASE_DOMAIN
21+
}
22+
23+
let urlString = "wss://streaming-rekognition.\(region).\(baseDomain)/start-face-liveness-session-websocket"
1224
guard let url = URL(string: urlString) else {
1325
throw FaceLivenessSessionError.invalidRegion
1426
}

0 commit comments

Comments
 (0)