SCSChat
@interface SCSChat : NSObject
The SCSChat class is the main interface to the Live Agent Chat SDK.
This object manages the flow of Chat sessions throughout the lifetime of the app.
To get an instance of this class, use the SCServiceCloud.chat property
on +[SCServiceCloud sharedInstance].
SCSChat conforms to a multicast delegate model for messaging. Any class which
implements the SCSChatDelegate protocol can be added to a list of delegates to
receive messages asynchronously.
For UI-related chat features, see SCSChatInterface.
See
SCSChatInterface
-
A reference to the
SCSChatConfigurationobject provided to the session on start.Declaration
Objective-C
@property (readonly, strong, nonatomic) SCSChatConfiguration *configuration;Swift
var configuration: SCSChatConfiguration! { get }
-
This method begins the process of starting a Live Agent Chat session.
Equivalent to invoking
-startSessionWithConfiguration:completion:and providing anilblock.Declaration
Objective-C
- (void)startSessionWithConfiguration:(SCSChatConfiguration *)config;Swift
func startSession(with config: SCSChatConfiguration!)Parameters
configThe
SCSChatConfigurationobject which represents the session configuration. -
This method begins the process of starting a Live Agent Chat session.
Note
Calling
-stopSessionat any point after calling-startSessionWithConfiguration:will not necessarily terminate a session in progress. Once the user has moved past the pre-chat phase, this will trigger a prompt asking the user if they wish to terminate the session.Declaration
Objective-C
- (void)startSessionWithConfiguration:(SCSChatConfiguration *)config completion:(__strong SCSChatCompletionHandler)block;Swift
func startSession(with config: SCSChatConfiguration!, completion block: SCSChatCompletionHandler!)Parameters
configThe
SCSChatConfigurationobject which represents the session configuration.blockCompletion block which will be executed when the session has been fully connected to all services. When the block is executed the session is active and waiting for an agent to join. The
NSErrorreturned in the block will benilon success. -
Stops an active or connecting session.
If the user has not moved past the pre-chat phase, this will immediately terminate the session and clean up all resources.
Equivalent to invoking
-stopSessionWithCompletion:and providing anilblock.Declaration
Objective-C
- (void)stopSession;Swift
func stopSession() -
Stops an active or connecting session.
If the user has not moved past the pre chat phase this will immediately terminate the session and clean up all resources.
Declaration
Objective-C
- (void)stopSessionWithCompletion:(__strong SCSChatCompletionHandler)block;Swift
func stopSession(completion block: SCSChatCompletionHandler!)Parameters
blockCompletion block which will be executed when the session has fully stopped, and all connected services have been torn down. The
NSErrorreturned in the block will benilon success. -
Queries Live Agent to determine agent availability to accept a chat session.
Declaration
Objective-C
- (void)determineAvailabilityWithConfiguration:(SCSChatConfiguration *)config completion: (__strong SCSChatAvailabilityHandler) block;Swift
func determineAvailability(with config: SCSChatConfiguration!, completion block: SCSChatAvailabilityHandler!)Parameters
configThe
SCSChatConfigurationobject which represents the session configuration.blockThe completion block that executes when the availability response returns.
-
Adds an instance of an
NSObjectimplementing theSCSChatDelegateprotocol to the list of delegates to notify.Declaration
Objective-C
- (void)addDelegate:(NSObject<SCSChatDelegate> *)delegate;Parameters
delegateNSObjectinstance to add. -
Removes an instance of an
NSObjectimplementing theSCSChatDelegateprotocol from the list of delegates to notify.Declaration
Objective-C
- (void)removeDelegate:(NSObject<SCSChatDelegate> *)delegate;Parameters
delegateNSObjectinstance to remove.
Install in Dash
SCSChat Class Reference