BDKChatClient

Objective-C

@protocol BDKChatClient <NSObject>

Swift

protocol ChatClient : NSObjectProtocol

It’s the main item required to connect to the Chat platform.

Client state

  • A property holding the current state of the client.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BDKChatClientState state;

    Swift

    var state: ChatClientState { get }
  • Returns a boolean flag indicating whether the client is stopped or not

    Declaration

    Objective-C

    - (BOOL)isStopped;

    Swift

    func isStopped() -> Bool

    Return Value

    a boolean flag indicating whether the client is stopped or not

  • Returns a boolean flag indicating whether the client is starting or not

    Declaration

    Objective-C

    - (BOOL)isStarting;

    Swift

    func isStarting() -> Bool

    Return Value

    a boolean flag indicating whether the client is starting or not

  • Returns a boolean flag indicating whether the client is running or not

    Declaration

    Objective-C

    - (BOOL)isRunning;

    Swift

    func isRunning() -> Bool

    Return Value

    a boolean flag indicating whether the client is running or not

  • Returns a boolean flag indicating whether the client is paused or not

    Declaration

    Objective-C

    - (BOOL)isPaused;

    Swift

    func isPaused() -> Bool

    Return Value

    a boolean flag indicating whether the client is paused or not

  • Returns a boolean flag indicating whether the client is resuming or not

    Declaration

    Objective-C

    - (BOOL)isResuming;

    Swift

    func isResuming() -> Bool

    Return Value

    a boolean flag indicating whether the client is resuming or not

  • Returns a boolean flag indicating whether the client is reconnecting or not

    Declaration

    Objective-C

    - (BOOL)isReconnecting;

    Swift

    func isReconnecting() -> Bool

    Return Value

    a boolean flag indicating whether the client is reconnecting or not

Observer

  • Adds an observer that will be notified synchronously on a private background queue. The observer object will be held weakly.

    Declaration

    Objective-C

    - (void)addObserver:(nonnull id<BDKChatClientObserver>)observer;

    Parameters

    observer

    The observer to be added.

  • Adds an observer specifying on which dispatch queue it must be notified. If a nil queue is provided the observer will be notified synchronously on a private background queue. Otherwise the observer will be notified asynchronously on the queue provided. The observer will be held weakly.

    Declaration

    Objective-C

    - (void)addObserver:(nonnull id<BDKChatClientObserver>)observer
                  queue:(nullable dispatch_queue_t)queue;

    Parameters

    observer

    The observer to add.

    queue

    The dispatch queue onto which the observer will be notified. May be nil.

  • Removes a client observer.

    Declaration

    Objective-C

    - (void)removeObserver:(nonnull id<BDKChatClientObserver>)observer;

    Parameters

    observer

    The observer to be removed.

Starting, stopping the client

  • Start the client, connecting it to Bandyer platform. You should call this method after opening a user session on the BandyerSDK singleton instance.

    See

    [BandyerSDK.instance openSessionWithUser:]

    Declaration

    Objective-C

    - (void)start;

    Swift

    func start()
  • Resumes the client, reconnecting it to Bandyer platform, after the client has been paused first. You should call this method after the client has been paused, for example you might resume the client when the app returns in foreground.

    Declaration

    Objective-C

    - (void)resume;

    Swift

    func resume()
  • Pause the client, disconnecting it from Bandyer platform. You should call this method when you want to stop the client from detecting incoming messages and sending outgoing messages, for example you might pause the client when the app goes in background.

    Declaration

    Objective-C

    - (void)pause;

    Swift

    func pause()
  • Stop the client, disconnecting it from Bandyer platform. You should stop it when app is going to be terminated. Once the client has been stopped, you must start it once again calling [BDKChatClient start] method if you want to reuse it.

    Declaration

    Objective-C

    - (void)stop;

    Swift

    func stop()