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

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

joinRoom:

- (BOOL)joinRoom:(QBChatRoom *)room
Discussion

Join room. QBChatDelegate’s method ‘chatRoomDidEnter:’ will be called

Warning: Deprecated in 2.3. Use ‘join’ in QBChatDialog class.

Parameters

room

Room to join

Return Value

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

Declared In

QBChat.h

joinRoom:historyAttribute:

- (BOOL)joinRoom:(QBChatRoom *)room historyAttribute:(NSDictionary *)historyAttribute
Discussion

Join room. QBChatDelegate’s method ‘chatRoomDidEnter:’ will be called

Warning: Deprecated in 2.3. Use ‘join’ in QBChatDialog class..

Parameters

room

Room to join

historyAttribute

Attribite to manage the amount of discussion history provided on entering a room. More info here http://xmpp.org/extensions/xep-0045.html#enter-history

Return Value

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

Declared In

QBChat.h

leaveRoom:

- (BOOL)leaveRoom:(QBChatRoom *)room
Discussion

Leave joined room. QBChatDelegate’s method ‘chatRoomDidLeave:’ will be called

Warning: Deprecated in 2.3. Use ‘leave’ in QBChatDialog class.

Parameters

room

Room to leave

Return Value

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

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

readMessage:

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

Send “Read message” status back to sender

Parameters

message

original message received from user

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

requestRoomOnlineUsers:

- (BOOL)requestRoomOnlineUsers:(QBChatRoom *)room
Discussion

Request users who are joined a room. QBChatDelegate’s method ‘chatRoomDidReceiveListOfOnlineUsers:room:’ will be called

Warning: Deprecated in 2.3. Use ‘requestOnlineUsers’ in QBChatDialog class.

Parameters

room

Room

Return Value

YES if the request was sent successfully. 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

sendChatMessage:toRoom:

- (BOOL)sendChatMessage:(QBChatMessage *)message toRoom:(QBChatRoom *)room
Discussion

Send chat message to room

Warning: Deprecated in 2.3. Use ‘sendMessage:’ in QBChatDialog class.

Parameters

message

Message body

room

Room to send message

Return Value

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

Declared In

QBChat.h

sendChatMessageWithoutJoin:toRoom:

- (BOOL)sendChatMessageWithoutJoin:(QBChatMessage *)message toRoom:(QBChatRoom *)room
Discussion

Available only for ‘Enterprise’ clients. Send chat message to room, without room join

Warning: Deprecated in 2.3. Use ‘sendGroupChatMessageWithoutJoin:’ in QBChatDialog class.

Parameters

message

Message body

room

Room to send message

Return Value

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

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

sendMessage:

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

Send message

Warning: Deprecated in 2.3. Use ‘sendMessage:’ in QBChatDialog class.

Parameters

Return Value

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

Declared In

QBChat.h

sendMessage:sentBlock:

- (BOOL)sendMessage:(QBChatMessage *)message sentBlock:(void ( ^ ) ( NSError *error ))sentBlock
Discussion

Send message with ‘sent’ block

Warning: Deprecated in 2.3. Use ‘sendMessage:sentBlock:’ in QBChatDialog class.

Parameters

message

QBChatMessage instance

sentBlock

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

Return Value

YES if the message was sent. 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

sendPresenceWithParameters:toRoom:

- (BOOL)sendPresenceWithParameters:(NSDictionary *)parameters toRoom:(QBChatRoom *)room
Discussion

Send presence with parameters to room

Warning: Deprecated in 2.3. Will be removed in future.

Parameters

parameters

Presence parameters

room

Room to send presence

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

sendPresenceWithStatus:show:priority:customParameters:toRoom:

- (BOOL)sendPresenceWithStatus:(NSString *)status show:(QBPresenseShow)show priority:(short)priority customParameters:(NSDictionary *)customParameters toRoom:(QBChatRoom *)room
Discussion

Send presence with status, show, priority, custom parameters to room

Warning: Deprecated in 2.3. Will be removed in future.

Parameters

status

Element contains character data specifying a natural-language description of availability status

show

Element contains non-human-readable character data that specifies the particular availability status of an entity or specific resource.

priority

Element contains non-human-readable character data that specifies the priority level of the resource. The value MUST be an integer between -128 and +127.

customParameters

Custom parameters

room

Room to send presence

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

sendUserIsTypingToUserWithID:

- (void)sendUserIsTypingToUserWithID:(NSUInteger)userID
Discussion

Send a chat status “user is typing” to user with given ID

Parameters

userID

user ID

Declared In

QBChat.h

sendUserStopTypingToUserWithID:

- (void)sendUserStopTypingToUserWithID:(NSUInteger)userID
Discussion

Send a chat status “user stop typing” to user with given ID

Parameters

userID

user ID

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