SCSChat
@interface SCSChat : NSObject
The SCSChat class is the core interface to the chat SDK.
This object manages the flow of chat sessions throughout the lifetime of the app.
For UI-related chat functionality, see SCSChatInterface.
To get an instance of this class, use the SCServiceCloud.chatCore property
on +[SCServiceCloud sharedInstance].
SCSChat conforms to a multicast delegate model for messaging. Any class that
implements the SCSChatSessionDelegate protocol can be added to a list of delegates to
receive session-related messages asynchronously using -addDelegate: Any class that
implements the SCSChatEventDelegate protocol can be added to a list of delegates to
receive general event messages asynchronously using -addEventDelegate:
See
SCSChatInterface
-
Notification identifier that is prepended to all push and local notifications generated by chat session. This can be used to differentiate notifications generated by chat from those generated by the host application.
Declaration
Objective-C
+ (NSString *)notificationIdentifier;Swift
class func notificationIdentifier() -> String!
-
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 } -
A reference to a chat session, which provides realtime information about the current state of the chat session.
Declaration
Objective-C
@property (readonly, strong, nonatomic) NSObject<SCSChatSession, SCSChatSessionInfo> *session;
-
Starts a chat session. Use this method if you intend to display your own UI. If you want to start a session with the default Snap-ins UI, see
-[SCSChatInterface showChatWithConfiguration:].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. -
Starts a chat session. Use this method if you intend to display your own UI. If you want to start a session with the default Snap-ins UI, see
-[SCSChatInterface showChatWithConfiguration:].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 that 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 isnilon 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
idimplementing theSCSChatSessionDelegateprotocol to the list of delegates to notify.Declaration
Objective-C
- (void)addDelegate:(id<SCSChatSessionDelegate>)delegate;Parameters
delegateidinstance to add. -
Adds an instance of an
idimplementing theSCSChatSessionDelegateprotocol to the list of delegates to notify.Declaration
Objective-C
- (void)addDelegate:(id<SCSChatSessionDelegate>)delegate queue:(dispatch_queue_t)queue;Parameters
delegateidinstance to add.queuedispatch_queue_tyou wish your events to be called back on. -
Removes an instance of an
idimplementing theSCSChatSessionDelegateprotocol from the list of delegates to notify.Declaration
Objective-C
- (void)removeDelegate:(id<SCSChatSessionDelegate>)delegate;Parameters
delegateidinstance to remove. -
Adds an instance of an
idimplementing theSCSChatEventDelegateprotocol to the list of delegates to notify.Declaration
Objective-C
- (void)addEventDelegate:(id<SCSChatEventDelegate>)delegate;Parameters
delegateidinstance to add. -
Adds an instance of an
idimplementing theSCSChatEventDelegateprotocol to the list of delegates to notify.Declaration
Objective-C
- (void)addEventDelegate:(id<SCSChatEventDelegate>)delegate queue:(dispatch_queue_t)queue;Parameters
queuedispatch_queue_tyou wish your events to be called back on. -
Removes an instance of an
idimplementing theSCSChatEventDelegateprotocol from the list of delegates to notify.Declaration
Objective-C
- (void)removeEventDelegate:(id<SCSChatEventDelegate>)delegate;Parameters
delegateidinstance to remove.
Install in Dash
SCSChat Class Reference