ConnectionProvider
public protocol ConnectionProvider
The provider for connection related properties and methods.
-
The current channel configuration for currently connected CXone session.
Declaration
Swift
var channelConfiguration: ChannelConfiguration { get } -
Makes an HTTP request to get the channel configuration details.
Throws
channelConfigFailureif provided parameters do not create a valid URL.Throws
DecodingError.dataCorruptedan indication that the data is corrupted or otherwise invalid.Throws
DecodingError.typeMismatchif the encountered stored value is not a JSON object or otherwise cannot be converted to the required type.Throws
DecodingError.keyNotFoundif the response does not have an entry for the given key.Throws
DecodingError.valueNotFoundif a response has a null value for the given key.Throws
URLError.badServerResponseif the URL Loading system received bad data from the server.Throws
NSErrorobject that indicates why the request failedDeclaration
Swift
func getChannelConfiguration(environment: Environment, brandId: Int, channelId: String) async throws -> ChannelConfigurationParameters
environmentThe CXone
Environmentused to connect. Relates to your location.brandIdThe unique id of the brand for which to open the connection.
channelIdThe unique id of the channel for the connection.
Return Value
Channel configuration details
-
getChannelConfiguration(chatURL:AsynchronousbrandId: channelId: ) Makes an HTTP request to get the channel configuration details.
Throws
channelConfigFailureif provided parameters do not create a valid URL.Throws
DecodingError.dataCorruptedan indication that the data is corrupted or otherwise invalid.Throws
DecodingError.typeMismatchif the encountered stored value is not a JSON object or otherwise cannot be converted to the required type.Throws
DecodingError.keyNotFoundif the response does not have an entry for the given key.Throws
DecodingError.valueNotFoundif a response has a null value for the given key.Throws
URLError.badServerResponseif the URL Loading system received bad data from the server.Throws
NSErrorobject that indicates why the request failedDeclaration
Swift
func getChannelConfiguration(chatURL: String, brandId: Int, channelId: String) async throws -> ChannelConfigurationParameters
chatURLThe chat URL for the custom environment.
brandIdThe unique id of the brand for which to open the connection.
channelIdThe unique id of the channel for the connection.
completionCompletion handler to be called when the request is successful or fails.
Return Value
Channel configuration details
-
prepare(environment:AsynchronousbrandId: channelId: ) Prepares the SDK for establishing connection to the CXone service.
In order to use any
AnalyticsProvidermethods, you must first call this method.Throws
illegalChatStateif it was unable to trigger the required method because the SDK is not in the required stateThrows
missingParameter(_:)if connectionurlis not in correct format.Throws
channelConfigFailureif the SDK could not prepare URL for URLRequestThrows
DecodingError.dataCorruptedan indication that the data is corrupted or otherwise invalid.Throws
DecodingError.typeMismatchif the encountered stored value is not a JSON object or otherwise cannot be converted to the required type.Throws
DecodingError.keyNotFoundif the response does not have an entry for the given key.Throws
DecodingError.valueNotFoundif a response has a null value for the given key.Throws
URLError.badServerResponseif the URL Loading system received bad data from the server.Throws
NSErrorobject that indicates why the request failedThrows
EncodingError.invalidValueif a non-conforming floating-point value is encountered during encoding, and the encoding strategy is.throw.Throws
An error if any value throws an error during encoding.
Declaration
Swift
func prepare(environment: Environment, brandId: Int, channelId: String) async throwsParameters
environmentThe CXone
Environmentused to connect. Relates to your location.brandIdThe unique id of the brand for which to open the connection.
channelIdThe unique id of the channel for the connection.
-
prepare(chatURL:AsynchronoussocketURL: brandId: channelId: ) Prepares the SDK for establishing connection to the CXone service.
In order to you use any
AnalyticsProvidermethods, it is necessary to call this method before invoking any of them.Throws
illegalChatStateif it was unable to trigger the required method because the SDK is not in the required stateThrows
missingParameter(_:)if connectionurlis not in correct format.Throws
channelConfigFailureif the SDK could not prepare URL for URLRequestThrows
DecodingError.dataCorruptedan indication that the data is corrupted or otherwise invalid.Throws
DecodingError.typeMismatchif the encountered stored value is not a JSON object or otherwise cannot be converted to the required type.Throws
DecodingError.keyNotFoundif the response does not have an entry for the given key.Throws
DecodingError.valueNotFoundif a response has a null value for the given key.Throws
URLError.badServerResponseif the URL Loading system received bad data from the server.Throws
NSErrorobject that indicates why the request failedThrows
EncodingError.invalidValueif a non-conforming floating-point value is encountered during encoding, and the encoding strategy is.throw.Throws
An error if any value throws an error during encoding.
Declaration
Swift
func prepare(chatURL: String, socketURL: String, brandId: Int, channelId: String) async throwsParameters
chatURLThe URL to be used for chat requests (channel config and attachment upload).
socketURLThe URL to be used for the WebSocket connection.
brandIdThe unique id of the brand for which to open the connection.
channelIdThe unique id of the channel for the connection.
-
connect()AsynchronousConnects to the CXone service via web socket.
This method establishes web socket connection to be able to receive chat events defined in
CXoneChatDelegate.Precondition
Either
prepare(environment:brandId:channelId:)orprepare(chatURL:socketURL:brandId:channelId:)method must be called before this method.Throws
illegalChatStateif it was unable to trigger the required method because the SDK is not in the required stateThrows
customerAssociationFailureif the SDK could not get customer identity and it may not have been set.Throws
missingAccessTokenif the customer was successfully authorized, but an access token wasn’t returned.Throws
invalidDatawhen the Data object cannot be successfully converted to a valid UTF-8 stringThrows
invalidParameter(_:)if the socket endpoint URL has not been set properlyThrows
channelConfigFailureif the SDK could not prepare URL for URLRequestThrows
EncodingError.invalidValue(_:_:)if the given value is invalid in the current context for this format.Throws
URLError.badServerResponseif the URL Loading system received bad data from the server.Throws
NSErrorobject that indicates why the request failedDeclaration
Swift
func connect() async throws -
Disconnects from the CXone service and keeps the customer signed in.
Declaration
Swift
func disconnect() -
Pings the CXone chat server to ensure that a connection is established.
Throws
illegalChatStateif it was unable to trigger the required method because the SDK is not in the required stateDeclaration
Swift
@available(*, deprecated, message: "Deprecated as of 2.2.0") func ping() throws -
Manually executes a trigger that was defined in CXone. This can be used to test that proactive actions are displaying.
Throws
illegalChatStateif it was unable to trigger the required method because the SDK is not in the required stateThrows
notConnectedif an attempt was made to use a method without connecting first. Make sure you call theconnectmethod first.Throws
customerVisitorAssociationFailureif the customer could not be associated with a visitor.Throws
customerAssociationFailureThe SDK instance could not get customer identity possibly because it may not have been set.Throws
invalidDatawhen the Data object cannot be successfully converted to a valid UTF-8 stringThrows
EncodingError.invalidValue(_:_:)if the given value is invalid in the current context for this format.Throws
An error if any value throws an error during encoding.
Declaration
Swift
func executeTrigger(_ triggerId: UUID) throwsParameters
triggerIdThe id of the trigger to manually execute.
View on GitHub