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
10 changes: 10 additions & 0 deletions Swift/KVSiOSApp/ChannelConfigurationViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,17 @@ class ChannelConfigurationViewController: UIViewController, UITextFieldDelegate
}
// get signalling channel endpoints
let endpoints = getSignallingEndpoints(channelARN: channelARN!, region: awsRegionValue, isMaster: self.isMaster, useMediaServer: usingMediaServer)
//// Ensure that the WebSocket (WSS) endpoint is available; WebRTC requires a valid signaling endpoint.
if endpoints["WSS"] == nil {
popUpError(title: "Invalid SignallingEndpoints", message: "SignallingEndpoints is required for WebRTC connection")
return
}
let wssURL = createSignedWSSUrl(channelARN: channelARN!, region: awsRegionValue, wssEndpoint: endpoints["WSS"]!, isMaster: self.isMaster)
// Ensure that the signed WebSocket URL is successfully created; a valid signed URL is required to establish a WebRTC connection.
if wssURL == nil {
popUpError(title: "Failed to create signed WSSUrl", message: "SignedWSSUrl is required for WebRTC connection")
return
}
print("WSS URL :", wssURL?.absoluteString as Any)
// get ice candidates using https endpoint
let httpsEndpoint =
Expand Down
3 changes: 3 additions & 0 deletions Swift/KVSiOSApp/KVSSigner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class KVSSigner {
static func iso8601() -> (fullDateTimestamp: String, shortDate: String) {
let dateFormatter: DateFormatter = DateFormatter()
dateFormatter.dateFormat = utcDateFormatter
// Ensures the date format is consistent regardless of the device's regional settings, preventing issues with 12-hour vs. 24-hour time formats.
dateFormatter.locale = Locale(identifier: "en_US_POSIX")
dateFormatter.timeZone = TimeZone(abbreviation: utcTimezone)
let date = Date()
let dateString = dateFormatter.string(from: date)
Expand Down Expand Up @@ -143,6 +145,7 @@ class KVSSigner {
queryParamsBuilderArray.append(URLQueryItem(name: xAmzSignature, value: signature))

if #available(iOS 11.0, *) {
// ensuring that special characters (such as spaces in timestamps) are handled correctly.
components.percentEncodedQueryItems = queryParamsBuilderArray
} else {

Expand Down
Loading