ConnectionProvider
@objc(ZDKConnectionProvider)
public final class ConnectionProvider : NSObject
ZDKConnectionProvider
gives the ability to observe connection updates.
-
The current status of the Connection
Declaration
Swift
@objc public var status: ConnectionStatus { get }
-
Connect to the session
Declaration
Swift
@objc public func connect()
-
Disconnect from the current session, closes the socket connection. Please note, this won’t end the chat session with agent
Declaration
Swift
@objc public func disconnect()
-
Observe connection status updates. Specify a closure how the status should be handled
Declaration
Swift
public func observeConnectionStatus(identifier: ObservableIdentifier = .uuid(), _ completion: @escaping (ConnectionStatus) -> Void) -> ObservationToken
Parameters
identifier
ObservableIdentifier to be exclusive, or unique
completion
Specify how to handle the
ConnectionStatus
via closure.Return Value
An
ObservationToken
that can cancel the subscription to theConnectionStatus
.