Inherits from NSObject
Declared in QBChat.h

Overview

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

Tasks

Properties

contactList

@property (nonatomic, readonly, nullable) QBContactList *contactList
Discussion

Contact list

Declared In

QBChat.h

isConnected

@property (assign, nonatomic, readonly) BOOL isConnected
Discussion

Determines whether chat is connected. Returns YES if the connection is open, and the stream has been properly established.

If the stream is neither disconnected, nor connected, then a connection is currently being established. If this method returns YES, then it is ready for you to start sending and receiving elements.

Declared In

QBChat.h

isConnecting

@property (assign, nonatomic, readonly) BOOL isConnecting
Discussion

Returns YES is the connection is currently connecting

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:completion:

- (void)addUserToContactListRequest:(NSUInteger)userID completion:(nullable QBChatCompletionBlock)completion
Discussion

Add user to contact list request

Parameters

userID

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

completion

Completion block with failure error.

Declared In

QBChat.h

confirmAddContactRequest:completion:

- (void)confirmAddContactRequest:(NSUInteger)userID completion:(nullable QBChatCompletionBlock)completion
Discussion

Confirm add to contact list request

Parameters

userID

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

completion

The block which informs whether a request was delivered to server or not. If request succeded error is nil.

Declared In

QBChat.h

connectWithUser:completion:

- (void)connectWithUser:(QBUUser *)user completion:(nullable QBChatCompletionBlock)completion
Discussion

Connect to QuickBlox Chat with completion.

Parameters

user

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

completion

Completion block with failure error.

Declared In

QBChat.h

connectWithUser:resource:completion:

- (void)connectWithUser:(QBUUser *)user resource:(nullable NSString *)resource completion:(nullable QBChatCompletionBlock)completion
Discussion

Connect to QuickBlox Chat.

Parameters

user

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

resource

The resource identifier of user.

completion

Completion block with failure error.

Declared In

QBChat.h

currentUser

- (nullable QBUUser *)currentUser
Discussion

Get current chat user

Return Value

Declared In

QBChat.h

delegates

- (nullable NSArray<id<QBChatDelegate> > *)delegates
Discussion

Array of all delegates

Declared In

QBChat.h

disconnectWithCompletionBlock:

- (void)disconnectWithCompletionBlock:(nullable QBChatCompletionBlock)completion
Discussion

Disconnect current user from Chat and leave all rooms

Parameters

completion

Completion block with failure error.

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

markAsDelivered:completion:

- (void)markAsDelivered:(QBChatMessage *)message completion:(nullable QBChatCompletionBlock)completion
Discussion

Send “delivered” status for message.

Parameters

message

QBChatMessage message to mark as delivered.

completion

Completion block with failure error.

Declared In

QBChat.h

pingServer:

- (void)pingServer:(QBPingCompleitonBlock)completion
Discussion

Send ping to server

Parameters

completion

completion block with ping time interval and success flag

Declared In

QBChat.h

pingServerWithTimeout:completion:

- (void)pingServerWithTimeout:(NSTimeInterval)timeout completion:(QBPingCompleitonBlock)completion
Discussion

Send ping to server with timeout

Parameters

timeout

timeout

completion

completion block with ping time interval and success flag

Declared In

QBChat.h

pingUserWithID:completion:

- (void)pingUserWithID:(NSUInteger)userID completion:(QBPingCompleitonBlock)completion
Discussion

Send ping to user

Note: You must be subscribed to user in contact list in order to successfully ping him

Parameters

userID

User ID

completion

completion block with ping time interval and success flag

Declared In

QBChat.h

pingUserWithID:timeout:completion:

- (void)pingUserWithID:(NSUInteger)userID timeout:(NSTimeInterval)timeout completion:(QBPingCompleitonBlock)completion
Discussion

Send ping to user with timeout

Note: You must be subscribed to user in contact list in order to successfully ping him

Parameters

userID

User ID

timeout

Timeout in seconds

completion

completion block with ping time interval and success flag

Declared In

QBChat.h

readMessage:completion:

- (void)readMessage:(QBChatMessage *)message completion:(nullable QBChatCompletionBlock)completion
Discussion

Send “read” status for message and update “read” status on a server

Parameters

message

QBChatMessage message to mark as read.

completion

Completion block with failure error.

Declared In

QBChat.h

rejectAddContactRequest:completion:

- (void)rejectAddContactRequest:(NSUInteger)userID completion:(nullable QBChatCompletionBlock)completion
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

completion

The block which informs whether a request was delivered to server or not. If request succeded error is nil.

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:completion:

- (void)removeUserFromContactList:(NSUInteger)userID completion:(nullable QBChatCompletionBlock)completion
Discussion

Remove user from contact list

Parameters

userID

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

completion

Completion block with failure error.

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

sendPresenceWithStatus:

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

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

Parameters

status

Presence status.

Return Value

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

Declared In

QBChat.h

sendSystemMessage:completion:

- (void)sendSystemMessage:(QBChatMessage *)message completion:(nullable QBChatCompletionBlock)completion
Discussion

Send system message to dialog.

Parameters

message

QBChatMessage instance of message to send.

completion

Completion block with failure error.

Declared In

QBChat.h

setActivePrivacyListWithName:

- (void)setActivePrivacyListWithName:(nullable 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:(nullable 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:(nullable QBPrivacyList *)privacyList
Discussion

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

Parameters

privacyList

instance of QBPrivacyList

Declared In

QBChat.h