Inherits from NSObject
Declared in QBChat.h

Overview

This class is the main entry point to work with Quickblox Chat API.

Tasks

Other Methods

Deprecated Methods

Properties

autoReconnectEnabled

@property (nonatomic, assign, getter=isAutoReconnectEnabled) BOOL autoReconnectEnabled
Discussion

Enable or disable auto reconnect

Declared In

QBChat.h

backgroundingEnabled

@property (nonatomic, assign, getter=isBackgroundingEnabled) BOOL backgroundingEnabled
Discussion

Background mode for stream. By default is NO. Should be set before login to chat. Does not work on simulator.

Declared In

QBChat.h

carbonsEnabled

@property (nonatomic, assign, getter=isCarbonsEnabled) BOOL carbonsEnabled
Discussion

Enable or disable message carbons

Declared In

QBChat.h

contactList

@property (nonatomic, readonly) QBContactList *contactList
Discussion

Contact list

Declared In

QBChat.h

delegate

@property (weak, nonatomic) id<QBChatDelegate> delegate
Discussion

QBChat delegate for callbacks

Warning: Deprecated in QB iOS SDK 2.1: Use addDelegate: instead

Declared In

QBChat.h

keepAliveInterval

@property (nonatomic, assign) NSTimeInterval keepAliveInterval
Discussion

Many routers will teardown a socket mapping if there is no activity on the socket. For this reason, the stream supports sending keep-alive data. This is simply whitespace, which is ignored by the protocol.

Keep-alive data is only sent in the absence of any other data being sent/received.

The default value is 20s. The minimum value for TARGET_OS_IPHONE is 10s, else 20s.

To disable keep-alive, set the interval to zero (or any non-positive number).

The keep-alive timer (if enabled) fires every (keepAliveInterval / 4) seconds. Upon firing it checks when data was last sent/received, and sends keep-alive data if the elapsed time has exceeded the keepAliveInterval. Thus the effective resolution of the keepalive timer is based on the interval.

Declared In

QBChat.h

reconnectTimerInterval

@property (nonatomic, assign) NSTimeInterval reconnectTimerInterval
Discussion

A reconnect timer may optionally be used to attempt a reconnect periodically. The default value is 5 seconds

Declared In

QBChat.h

streamManagementEnabled

@property (nonatomic, assign, getter=isStreamManagementEnabled) BOOL streamManagementEnabled
Discussion

Enable or disable Stream Management (XEP-0198)

Declared In

QBChat.h

streamManagementSendMessageTimeout

@property (nonatomic, assign) int streamManagementSendMessageTimeout
Discussion

The timeout value for Stream Management send a message operation

Declared In

QBChat.h

streamResumptionEnabled

@property (nonatomic, assign, getter=isStreamResumptionEnabled) BOOL streamResumptionEnabled
Discussion

Enable or disable Stream Resumption (XEP-0198). Works only if streamManagementEnabled=YES.

Declared In

QBChat.h

Class Methods

instance

+ (instancetype)instance
Discussion

Get QBChat singleton

Return Value

QBChat Chat service singleton

Declared In

QBChat.h

Instance Methods

addDelegate:

- (void)addDelegate:(id<QBChatDelegate>)delegate
Discussion

Adds the given delegate implementation to the list of observers

Parameters

delegate

The delegate to add

Declared In

QBChat.h

addUserToContactListRequest:

- (BOOL)addUserToContactListRequest:(NSUInteger)userID
Discussion

Add user to contact list request

Parameters

userID

ID of user which you would like to add to contact list

Return Value

YES if the request was sent successfully. If not - see log.

Declared In

QBChat.h

addUserToContactListRequest:sentBlock:

- (BOOL)addUserToContactListRequest:(NSUInteger)userID sentBlock:(void ( ^ ) ( NSError *error ))sentBlock
Discussion

Add user to contact list request

Parameters

userID

ID of user which you would like to add to contact list

sentBlock

The block which informs whether a request was delivered to server or not. nil if no errors.

Return Value

YES if the request was sent. If not - see log.

Declared In

QBChat.h

confirmAddContactRequest:

- (BOOL)confirmAddContactRequest:(NSUInteger)userID
Discussion

Confirm add to contact list request

Parameters

userID

ID of user from which you would like to confirm add to contact request

Return Value

YES if the request was sent successfully. If not - see log.

Declared In

QBChat.h

confirmAddContactRequest:sentBlock:

- (BOOL)confirmAddContactRequest:(NSUInteger)userID sentBlock:(void ( ^ ) ( NSError *error ))sentBlock
Discussion

Confirm add to contact list request

Parameters

userID

ID of user from which you would like to confirm add to contact request

sentBlock

The block which informs whether a request was delivered to server or not. nil if no errors.

Return Value

YES if the request was sent. If not - see log.

Declared In

QBChat.h

currentUser

- (QBUUser *)currentUser
Discussion

Get current chat user

Return Value

Declared In

QBChat.h

delegates

- (NSArray *)delegates
Discussion

Array of all delegates

Declared In

QBChat.h

forceReconnect

- (void)forceReconnect
Discussion

Run force reconnect. This method disconnects from chat and runs reconnection logic. Works only if autoReconnectEnabled=YES. Otherwise it does nothing.

Declared In

QBChat.h

init

- (id)init

isLoggedIn

- (BOOL)isLoggedIn
Discussion

Check if current user logged into Chat

Return Value

YES if user is logged in, NO otherwise

Declared In

QBChat.h

loginWithUser:

- (BOOL)loginWithUser:(QBUUser *)user
Discussion

Authorize on QuickBlox Chat

Parameters

user

QBUUser structure represents user’s login. Required user’s fields: ID, password;

Return Value

YES if the request was sent successfully. If not - see log.

Declared In

QBChat.h

loginWithUser:resource:

- (BOOL)loginWithUser:(QBUUser *)user resource:(NSString *)resource
Discussion

Authorize on QuickBlox Chat

Parameters

user

QBUUser structure represents user’s login. Required user’s fields: ID, password.

resource

The resource identifier of user.

Return Value

YES if the request was sent successfully. If not - see log.

Declared In

QBChat.h

logout

- (BOOL)logout
Discussion

Logout current user from Chat

Return Value

YES if the request was sent successfully. If not - see log.

Declared In

QBChat.h

markAsDelivered:

- (BOOL)markAsDelivered:(QBChatMessage *)message
Discussion

Send “delivered” status for message.

Parameters

message

QBChatMessage message to mark as delivered.

Return Value

YES if the request was sent successfully. If not - see log.

Declared In

QBChat.h

readMessage:

- (BOOL)readMessage:(QBChatMessage *)message
Discussion

Send “read” status for message.

Parameters

message

QBChatMessage message to mark as read.

Return Value

YES if the request was sent successfully. If not - see log.

Declared In

QBChat.h

rejectAddContactRequest:

- (BOOL)rejectAddContactRequest:(NSUInteger)userID
Discussion

Reject add to contact list request or cancel previously-granted subscription request

Parameters

userID

ID of user from which you would like to reject add to contact request

Return Value

YES if the request was sent successfully. If not - see log.

Declared In

QBChat.h

rejectAddContactRequest:sentBlock:

- (BOOL)rejectAddContactRequest:(NSUInteger)userID sentBlock:(void ( ^ ) ( NSError *error ))sentBlock
Discussion

Reject add to contact list request or cancel previously-granted subscription request

Parameters

userID

ID of user from which you would like to reject add to contact request

sentBlock

The block which informs whether a request was delivered to server or not. nil if no errors.

Return Value

YES if the request was sent. If not - see log.

Declared In

QBChat.h

removeAllDelegates

- (void)removeAllDelegates
Discussion

Removes all delegates

Declared In

QBChat.h

removeDelegate:

- (void)removeDelegate:(id<QBChatDelegate>)delegate
Discussion

Removes the given delegate implementation from the list of observers

Parameters

delegate

The delegate to remove

Declared In

QBChat.h

removePrivacyListWithName:

- (void)removePrivacyListWithName:(NSString *)privacyListName
Discussion

Remove a privacy list. QBChatDelegate’s method ‘didRemovedPrivacyListWithName:’ will be called if success or ‘didNotSetPrivacyListWithName:error:’ if there is an error

Parameters

privacyListName

name of privacy list

Declared In

QBChat.h

removeUserFromContactList:

- (BOOL)removeUserFromContactList:(NSUInteger)userID
Discussion

Remove user from contact list

Parameters

userID

ID of user which you would like to remove from contact list

Return Value

YES if the request was sent successfully. If not - see log.

Declared In

QBChat.h

removeUserFromContactList:sentBlock:

- (BOOL)removeUserFromContactList:(NSUInteger)userID sentBlock:(void ( ^ ) ( NSError *error ))sentBlock
Discussion

Remove user from contact list

Parameters

userID

ID of user which you would like to remove from contact list

sentBlock

The block which informs whether a request was delivered to server or not. nil if no errors.

Return Value

YES if the request was sent. If not - see log.

Declared In

QBChat.h

retrievePrivacyListNames

- (void)retrievePrivacyListNames
Discussion

Retrieve privacy list names. QBChatDelegate’s method ‘didReceivePrivacyListNames:’ will be called if success or ‘didNotReceivePrivacyListNamesDueToError:’ if there is an error

Declared In

QBChat.h

retrievePrivacyListWithName:

- (void)retrievePrivacyListWithName:(NSString *)privacyListName
Discussion

Retrieve a privacy list by name. QBChatDelegate’s method ‘didReceivePrivacyList:’ will be called if success or ‘didNotReceivePrivacyListWithName:error:’ if there is an error

Parameters

privacyListName

name of privacy list

Declared In

QBChat.h

sendDirectPresenceWithStatus:toUser:

- (BOOL)sendDirectPresenceWithStatus:(NSString *)status toUser:(NSUInteger)userID
Discussion

Send direct presence message with status to user. User must be in your contact list.

Warning: Deprecated in QB iOS SDK 2.3: Will be removed in future.

Return Value

YES if the request was sent successfully. If not - see log.

Declared In

QBChat.h

sendPresence

- (BOOL)sendPresence
Discussion

Send presence message. Session will be closed in 90 seconds since last activity.

Return Value

YES if the request was sent successfully. If not - see log.

Declared In

QBChat.h

sendPresenceWithStatus:

- (BOOL)sendPresenceWithStatus:(NSString *)status
Discussion

Send presence message with status. Session will be closed in 90 seconds since last activity.

Return Value

YES if the request was sent successfully. If not - see log.

Declared In

QBChat.h

sendSystemMessage:

- (BOOL)sendSystemMessage:(QBChatMessage *)message
Discussion

Send system message to dialog.

Parameters

message

Chat message to send.

Return Value

YES if the message was sent. If not - see log.

Declared In

QBChat.h

setActivePrivacyListWithName:

- (void)setActivePrivacyListWithName:(NSString *)privacyListName
Discussion

Set an active privacy list. QBChatDelegate’s method ‘didSetActivePrivacyListWithName:’ will be called if success or ‘didNotSetActivePrivacyListWithName:error:’ if there is an error

Parameters

privacyListName

name of privacy list

Declared In

QBChat.h

setDefaultPrivacyListWithName:

- (void)setDefaultPrivacyListWithName:(NSString *)privacyListName
Discussion

Set a default privacy list. QBChatDelegate’s method ‘didSetDefaultPrivacyListWithName:’ will be called if success or ‘didNotSetDefaultPrivacyListWithName:error:’ if there is an error

Parameters

privacyListName

name of privacy list

Declared In

QBChat.h

setPrivacyList:

- (void)setPrivacyList:(QBPrivacyList *)privacyList
Discussion

Create/edit a privacy list. QBChatDelegate’s method ‘didReceivePrivacyList:’ will be called

Parameters

privacyList

instance of QBPrivacyList

Declared In

QBChat.h