Inherits from NSObject
Declared in RespokeClient.h

Overview

This is a top-level interface to the API. It handles authenticating the app to the API server, receiving server-side app-specific information, keeping track of connection status and presence, accepting callbacks and listeners, and interacting with information the library keeps track of, like groups and endpoints. The client also keeps track of default settings for calls and direct connections as well as automatically reconnecting to the service when network activity is lost.

Tasks

Other Methods

private Methods

Properties

delegate

@property (weak) id<RespokeClientDelegate> delegate
Discussion

The delegate that should receive notifications from the RespokeClientDelegate protocol

Declared In

RespokeClient.h

resolveDelegate

@property (weak) id<RespokeResolvePresenceDelegate> resolveDelegate
Discussion

The optional delegate that should resolve the presence for an endpoint

Declared In

RespokeClient.h

Instance Methods

connectWithEndpointID:appID:reconnect:initialPresence:errorHandler:

- (void)connectWithEndpointID:(NSString *)endpoint appID:(NSString *)appID reconnect:(BOOL)reconnect initialPresence:(NSObject *)presence errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

Connect to the Respoke infrastructure and authenticate in development mode using the specified endpoint ID and app ID. Attempt to obtain an authentication token automatically from the Respoke infrastructure. Get the first set of TURN credentials and store them internally for later use.

Parameters

endpoint

The endpoint ID to use when connecting

appID

Your Application ID

reconnect

Whether or not to automatically reconnect to the Respoke service when a disconnect occurs.

presence

The optional initial presence value to set for this client

errorHandler

A block called when an error occurs, passing a string describing the error

Declared In

RespokeClient.h

connectWithTokenID:initialPresence:errorHandler:

- (void)connectWithTokenID:(NSString *)tokenID initialPresence:(NSObject *)presence errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

Connect to the Respoke infrastructure and authenticate with the specified token ID. Get the first set of TURN credentials and store them internally for later use.

Parameters

tokenID

The token ID to use when connecting

presence

The optional initial presence value to set for this client

errorHandler

A block called when an error occurs, passing a string describing the error

Declared In

RespokeClient.h

disconnect

- (void)disconnect
Discussion

Disconnect from the Respoke infrastructure, leave all groups, invalidate the token, and disconnect the websocket.

Declared In

RespokeClient.h

getConnectionWithID:endpointID:skipCreate:

- (RespokeConnection *)getConnectionWithID:(NSString *)connectionID endpointID:(NSString *)endpointID skipCreate:(BOOL)skipCreate
Discussion

Find a Connection by id and return it. In most cases, if we don’t find it we will create it. This is useful in the case of dynamic endpoints where groups are not in use. Set skipCreate=true to return nil if the Connection is not already known.

Parameters

connectionID

The ID of the connection to return

endpointID

The ID of the endpoint to which this connection belongs

skipCreate

If true, reurn nil if the connection is not already known

Return Value

The connection whose ID was specified

Declared In

RespokeClient.h

getConversations:errorHandler:

- (void)getConversations:(void ( ^ ) ( NSDictionary *))successHandler errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

For the connected endpoint, fetch a record that describes every conversation that the server has history on.

Parameters

successHandler

The block called when this async operation has completed successfully.

errorHandler

The block called when this async operation has completed with an error

Declared In

RespokeClient.h

getEndpointID

- (NSString *)getEndpointID
Discussion

Return the Endpoint ID of this client

Return Value

The Endpoint ID of this client

Declared In

RespokeClient.h

getEndpointWithID:skipCreate:

- (RespokeEndpoint *)getEndpointWithID:(NSString *)endpointIDToFind skipCreate:(BOOL)skipCreate
Discussion

Find an endpoint by id and return it. In most cases, if we don’t find it we will create it. This is useful in the case of dynamic endpoints where groups are not in use. Set skipCreate=true to return nil if the Endpoint is not already known.

Parameters

endpointIDToFind

The ID of the endpoint to return

skipCreate

If true, reurn nil if the connection is not already known

Return Value

The endpoint whose ID was specified

Declared In

RespokeClient.h

getGroupHistoriesForGroupIDs:maxMessages:successHandler:errorHandler:

- (void)getGroupHistoriesForGroupIDs:(NSArray *)groupIDs maxMessages:(NSInteger)maxMessages successHandler:(void ( ^ ) ( NSDictionary *))successHandler errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

Retrieve the history of messages that have been persisted for 1 or more groups. Only those messages that have been marked to be persisted when sent will show up in the history.

Parameters

groupIDs

The groups to pull history for

maxMessages

The maximum number of messages per group to pull. Must be >= 1

successHandler

The block called when this async operation has completed successfully

errorHandler

The block called when this async operation has completed with an error

Declared In

RespokeClient.h

getGroupHistoriesForGroupIDs:successHandler:errorHandler:

- (void)getGroupHistoriesForGroupIDs:(NSArray *)groupIDs successHandler:(void ( ^ ) ( NSDictionary *))successHandler errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

Retrieve the history of messages that have been persisted for 1 or more groups. Only those messages that have been marked to be persisted when sent will show up in the history. Only the most recent message in each group will be retrieved - to pull more messages, use the other method signature that allows maxMessages to be specified.

Parameters

groupIDs

The groups to pull history for

successHandler

The block called when this async operation has completed successfully

errorHandler

The block called when this async operation has completed with an error

Declared In

RespokeClient.h

getGroupHistoryForGroupID:maxMessages:before:successHandler:errorHandler:

- (void)getGroupHistoryForGroupID:(NSString *)groupID maxMessages:(NSInteger)maxMessages before:(NSDate *)before successHandler:(void ( ^ ) ( NSArray *))successHandler errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

Retrieve the history of messages that have been persisted for a specific group. Only those messages that have been marked to be persisted when sent will show up in the history.

Parameters

groupID

The groups to pull history for

maxMessages

The maximum number of messages per group to pull. Must be >= 1

before

Limit messages to those with a timestamp before this value

successHandler

The block called when this async operation has completed successfully

errorHandler

The block called when this async operation has completed with an error

Declared In

RespokeClient.h

getGroupHistoryForGroupID:maxMessages:successHandler:errorHandler:

- (void)getGroupHistoryForGroupID:(NSString *)groupID maxMessages:(NSInteger)maxMessages successHandler:(void ( ^ ) ( NSArray *))successHandler errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

Retrieve the history of messages that have been persisted for a specific group. Only those messages that have been marked to be persisted when sent will show up in the history. To retrieve messages further back in the history than right now, use the other method signature that allows before to be specified.

Parameters

groupID

The groups to pull history for

maxMessages

The maximum number of messages per group to pull. Must be >= 1

successHandler

The block called when this async operation has completed successfully

errorHandler

The block called when this async operation has completed with an error

Declared In

RespokeClient.h

getGroupHistoryForGroupID:successHandler:errorHandler:

- (void)getGroupHistoryForGroupID:(NSString *)groupID successHandler:(void ( ^ ) ( NSArray *))successHandler errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

Retrieve the history of messages that have been persisted for a specific group. Only those messages that have been marked to be persisted when sent will show up in the history. Only the 50 most recent messages in each group will be retrieved - to change the maximum number of messages pulled, use the other method signature that allows maxMessages to be specified. To retrieve messages further back in the history than right now, use the other method signature that allows before to be specified.

Parameters

groupID

The groups to pull history for

successHandler

The block called when this async operation has completed successfully

errorHandler

The block called when this async operation has completed with an error

Declared In

RespokeClient.h

getGroupWithID:

- (RespokeGroup *)getGroupWithID:(NSString *)groupID
Discussion

Returns the group with the specified ID

Return Value

The group with specified ID

Declared In

RespokeClient.h

getPresence

- (NSObject *)getPresence
Discussion

Get the current presence of this client

Return Value

The current presence value

Declared In

RespokeClient.h

isConnected

- (BOOL)isConnected
Discussion

Check whether we are connected to the backend infrastructure.

Return Value

True if connected

Declared In

RespokeClient.h

joinConferenceWithDelegate:conferenceID:

- (RespokeCall *)joinConferenceWithDelegate:(id<RespokeCallDelegate>)delegate conferenceID:(NSString *)conferenceID
Discussion

Initiate a call to a conference.

Parameters

delegate

The delegate to receive notifications about the new call

conferenceID

The ID of the conference to call

Return Value

A reference to the new RespokeCall object representing this call

Declared In

RespokeClient.h

joinGroups:successHandler:errorHandler:

- (void)joinGroups:(NSArray *)groupNames successHandler:(void ( ^ ) ( NSArray *))successHandler errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

Join a list of Groups and begin keeping track of them.

Parameters

groupNames

The names of the groups to join

successHandler

A block called when the group is joined successfully, passing a reference to the group

errorHandler

A block called when an error occurs, passing a string describing the error

Declared In

RespokeClient.h

registerPushServicesWithToken:

- (void)registerPushServicesWithToken:(NSData *)token
Discussion

Register push services for this client’s connection

Parameters

token

The push token to use

Declared In

RespokeClient+private.h

setBaseURL:

- (void)setBaseURL:(NSString *)newBaseURL
Discussion

Set the base URL of the Respoke service

Parameters

newBaseURL

The URL to use

Declared In

RespokeClient+private.h

setConversationsRead:successHandler:errorHandler:

- (void)setConversationsRead:(NSArray *)conversationStatuses successHandler:(void ( ^ ) ( NSDictionary *))successHandler errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

For each specified conversations, updates the “read” status up to the given timestamp. Messages older than the given timestamp will be considered “read” for this endpoint.

Parameters

conversationStatuses

An array of RespokeConversationReadStatus object references.

successHandler

The block called when this async operation has completed successfully.

errorHandler

The block called when this async operation has completed with an error

Declared In

RespokeClient.h

setOfflineWithSuccessHandler:errorHandler:

- (void)setOfflineWithSuccessHandler:(void ( ^ ) ( void ))successHandler errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

Convenience method for setting presence to “unavailable”.

Parameters

successHandler

A block called when the operation is successful

errorHandler

A block called when an error occurs, passing a string describing the error

Declared In

RespokeClient.h

setOnlineWithSuccessHandler:errorHandler:

- (void)setOnlineWithSuccessHandler:(void ( ^ ) ( void ))successHandler errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

Convenience method for setting presence to “available”.

Parameters

successHandler

A block called when the operation is successful

errorHandler

A block called when an error occurs, passing a string describing the error

Declared In

RespokeClient.h

setPresence:successHandler:errorHandler:

- (void)setPresence:(NSObject *)newPresence successHandler:(void ( ^ ) ( void ))successHandler errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

Set the presence on the client session

Parameters

newPresence

The new presence to use

successHandler

A block called when the operation is successful

errorHandler

A block called when an error occurs, passing a string describing the error

Declared In

RespokeClient.h

startAudioCallWithDelegate:endpointID:

- (RespokeCall *)startAudioCallWithDelegate:(id<RespokeCallDelegate>)delegate endpointID:(NSString *)endpointID
Discussion

Create a new audio-only call.

Parameters

delegate

The delegate to receive notifications about the new call

endpointID

The ID of the endpoint to call

Return Value

A reference to the new RespokeCall object representing this call

Declared In

RespokeClient.h

startVideoCallWithDelegate:endpointID:remoteVideoView:localVideoView:

- (RespokeCall *)startVideoCallWithDelegate:(id<RespokeCallDelegate>)delegate endpointID:(NSString *)endpointID remoteVideoView:(UIView *)newRemoteView localVideoView:(UIView *)newLocalView
Discussion

Create a new call with audio and video.

Parameters

delegate

The delegate to receive notifications about the new call

endpointID

The ID of the endpoint to call

newRemoteView

A UIView on which to project the remote video

newLocalView

A UIView on which to project the local video

Return Value

A reference to the new RespokeCall object representing this call

Declared In

RespokeClient.h

unregisterFromPushServicesWithSuccessHandler:errorHandler:

- (void)unregisterFromPushServicesWithSuccessHandler:(void ( ^ ) ( void ))successHandler errorHandler:(void ( ^ ) ( NSString *))errorHandler
Discussion

Unregister push services for this client

Declared In

RespokeClient+private.h