ChatState
public enum ChatState : Comparable
State of the chat
Here is a table of states with their basic description. Those states are internally handled by the SDK based on its usage.
State | Description |
---|---|
initial |
Initial state of the SDK |
preparing |
The SDK is preparing for usage |
prepared |
The SDK has been prepared for basic usage = unable to use chat features!. |
offline |
Channel currently unavailable (only for live chat channel configuration). |
connecting |
Socket connection is establishing for chat usage |
connected |
Socket connection has been established |
ready |
Chat is ready to use based on it’s configuration status |
closed |
An agent or customer has closed the thread |
-
Initial state of the SDK
The SDK has not yet been prepared for usage
Declaration
Swift
case initial
-
The SDK is preparing for usage
Websocket connection is not being established but it is possible to use
AnalyticsProvider
Declaration
Swift
case preparing
-
The SDK has been prepared for basic usage (unable to use chat features).
Channel configuration has been received and it is possible to use
AnalyticsProvider
. For chat usage it is necessary to CXone services viaconnect()
Declaration
Swift
case prepared
-
Channel currently unavailable
Each live chat channel has a defined availability when it is possible to connect to an agent. This state defines a situation where the channel is currently unavailable and will need to be connected later.
Precondition
CXoneChat.status == .liveChat
Declaration
Swift
case offline
-
Socket connection is establishing for chat usage
Declaration
Swift
case connecting
-
Socket connection has been established
Declaration
Swift
case connected
-
Chat is ready to use based on it’s configuration status
Singlethread
After the connection is established, the SDK automatically recovers any previously created thread. If there is no thread to recover, it automatically creates a new one.
Multithread
After establishing a connection, the SDK automatically fetches the thread list and loads metadata for each thread. If there are no threads, the state is set to
.ready
and empty chat list screen should be presented.LiveChat
Not yet implemented. Available from version 1.4.0
Declaration
Swift
case ready
-
An agent or customer has closed the thread
Whenever a thread is closed, the application should disable the sending of further messages and display the End Contact Experience screen.
Precondition
CXoneChat.status == .liveChat
Declaration
Swift
case closed
-
Check if chat is able to be prepared.
prepare(environment:brandId:channelId:)
should not be called when the chat is available (isChatAvailable
istrue
).Declaration
Swift
public var isPrepareable: Bool { get }