Bold360 and BoldChat Developer Center

Chat availability checking

The availability of the chat can be checked any time, without starting a chat session.

BCAccount has a non-periodic asynchronous service for that. The check is implemented by the following code:

id<BCCancelable> cancelable = [account getChatAvailabilityWithDelegate:<delegate object> visitorId:@"<visitor id>"];

The visitorId parameter is optional. It is for user identification on the server side, to be able to ban out certain users. This feature is detailed in [Creating Chat Session]. The service has the following callbacks:

- (void)bcChatAvailabilityChatAvailable:(id<BCCancelable>)cancelable {
    //The chat is available
}
- (void)bcChatAvailability:(id<BCCancelable>)cancelable chatUnavailableForReason:(BCUnavailableReason)reason {
    //The chat is not available
    // The reason is given in BCUnavailableReason enumeration.
}
- (void)bcChatAvailability:(id<BCCancelable>)cancelable didFailWithError:(NSError *)error {
    //Failed to check
    //Check error.code to values from BCErrorCodes.h to find out the cause of the error.
}

The chat unavailable reasons:

Since it is an asynchronous service, this can be canceled through the cancellable returned by the request. It is true for all following requests that return cancellable.

[cancelable cancel];

The result of chat availability is cached for 1 minute.