SCSChat Class Reference

Inherits from NSObject
Declared in SCSChat.h

Overview

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.

Properties

  configuration

A reference to the SCSChatConfiguration object provided to the session on start.

@property (nonatomic, readonly, strong) SCSChatConfiguration *configuration

Declared In

SCSChat.h

Session Control

– startSessionWithConfiguration:

This method begins the process of starting a Live Agent Chat session.

- (void)startSessionWithConfiguration:(SCSChatConfiguration *)config

Parameters

config

The SCSChatConfiguration object which represents the session configuration.

Discussion

Equivalent to invoking startSessionWithConfiguration:completion: and providing a nil block.

Declared In

SCSChat.h

– startSessionWithConfiguration:completion:

This method begins the process of starting a Live Agent Chat session.

- (void)startSessionWithConfiguration:(SCSChatConfiguration *)config completion:(SCSChatCompletionHandler)block

Parameters

config

The SCSChatConfiguration object which represents the session configuration.

block

Completion 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 NSError returned in the block will be nil on success.

Discussion

Note: Calling stopSession at 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.

Declared In

SCSChat.h

– stopSession

Stops an active or connecting session.

- (void)stopSession

Discussion

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 a nil block.

Declared In

SCSChat.h

– stopSessionWithCompletion:

Stops an active or connecting session.

- (void)stopSessionWithCompletion:(SCSChatCompletionHandler)block

Parameters

block

Completion block which will be executed when the session has fully stopped, and all connected services have been torn down. The NSError returned in the block will be nil on success.

Discussion

If the user has not moved past the pre chat phase this will immediately terminate the session and clean up all resources.

Declared In

SCSChat.h

– determineAvailabilityWithConfiguration:completion:

Queries Live Agent to determine agent availability to accept a chat session.

- (void)determineAvailabilityWithConfiguration:(SCSChatConfiguration *)config completion:(SCSChatAvailabilityHandler)block

Parameters

config

The SCSChatConfiguration object which represents the session configuration.

block

The completion block that executes when the availability response returns.

Declared In

SCSChat.h

Delegate Management

– addDelegate:

Adds an instance of an NSObject implementing the SCSChatDelegate protocol to the list of delegates to notify.

- (void)addDelegate:(NSObject<SCSChatDelegate> *)delegate

Parameters

delegate

NSObject instance to add.

Declared In

SCSChat.h

– removeDelegate:

Removes an instance of an NSObject implementing the SCSChatDelegate protocol from the list of delegates to notify.

- (void)removeDelegate:(NSObject<SCSChatDelegate> *)delegate

Parameters

delegate

NSObject instance to remove.

Declared In

SCSChat.h