Suggestions

close search

StringeeClient

@interface StringeeClient : NSObject

Represents a Stringee client, manages the client's connection. This class provides methods to connect to/disconnect from Stringee server, receives the connection's events, the incoming call event.

userId

It's the unique identification of the client on Stringee system.

@property (strong, nonatomic, readonly) NSString *userId;
hasConnected

Whether the client connects to Stringee server:
- hasConnected = YES, connected.
- hasConnected = No, not connected.

@property (assign, nonatomic, readonly) BOOL hasConnected;
connectionDelegate

A delegate to monitor the connection's events. For more information, see StringeeConnectionDelegate

@property (weak, nonatomic) id connectionDelegate;
incomingCallDelegate

A delegate to monitor when having an incoming call. For more information, see StringeeIncomingDelegate

@property (weak, nonatomic) id incomingCallDelegate;
- initWithConnectionDelegate:

Creates a new StringeClient instance and registers a connectionDelegate object.

- (instancetype)initWithConnectionDelegate:(id)delegate;
- connectWithAccessToken:

Connects to Stringee server with an access token.

- (void)connectWithAccessToken:(NSString *)accessToken;
- sendCustomMessage:toUserId:completionHandler:

Send a custom message to a user:
- message: Message to send.
- userId: User id to send a custom message to.
- status = YES, code = 0, message = "Success"
- status = NO, code = -1, message = "The client is not connected to Stringee Server."
- status = NO, code = -2, message = "toUserId is invalid."
- status = NO, code = -3, message = "Message can not be nil."

- (void)sendCustomMessage:(NSDictionary *)message toUserId:(NSString *)userId completionHandler:(void(^)(BOOL status, int code, NSString *message))completionHandler;
- registerPushForDeviceToken:isProduction:isVoip:completionHandler:

Register device token to receive push notification. When you have an incoming call, you receive a notification from Stringee server:
- deviceToken: the token received from Apple's server when you register push notification to Apple.
- isProduction = YES : For production environment, isProduction = NO: For development environment.
- isVoip = YES: To receive voip push notification, isVoip = NO: To receive remote push notification.
completionHandler returns the result of the registration:
- status = YES, code = 0, message = "Register successfully." or message = "Register successfully. This device token is already registered.".
- status = NO, code = 1, message = "Register failed. The Bundle Identifier has not been configured.".
- status = NO, code = -1, message = "Register failed. The client is not connected to Stringee Server".
- status = NO, code = -2, message = "Register failed. Data is empty.".
- status = NO, code = -3, message = "Register failed. Generic error.".

- (void)registerPushForDeviceToken:(NSString *)deviceToken isProduction:(BOOL)isProduction isVoip:(BOOL)isVoip completionHandler:(void(^)(BOOL status, int code, NSString * message))completionHandler;
- unregisterPushForDeviceToken:completionHandler:

Remove your device token from Stringee server. Your device will not receive push notification when you have an incoming call:
deviceToken: The device token which registered.
completionHandler: Returns the result of unregistering:
- status = YES, code = 0, message = "Unregister successfully." or message = "Unregister successfully. This device token is not on the system.".
- status = NO, code = 1, message = "Unregister failed. The Bundle Identifier has not been configured.".
- status = NO, code = -1, message = "Unregister failed. The client is not connected to Stringee Server".
- status = NO, code = -2, message = "Unregister failed. Generic error".

- (void)unregisterPushForDeviceToken:(NSString *)deviceToken completionHandler:(completion)completionHandler;
- disconnect:

Disconnects from Stringee server.

- (void)disconnect;