VIClient
VoximplantCore · iOS SDK v3
Interface that provides API to connect and log in to the Voximplant Cloud.
@objc final class VIClient
Properties
delegate
@objc weak var delegate: VIClientSessionDelegate? { get set }
Session delegate that handles events for the connection to the Voximplant Cloud.
shared
@objc static let shared: VIClient
Shared client instance.
state
@objc var state: VIClientState { get }
Current client state.
Methods
connect(to:gateways:completion:)
@objc func connect(
to node: VINode,
gateways: [String]? = [],
completion: @escaping (VIConnectionError?) -> Void
)
Connects to the Voximplant Cloud.
Parameters
node VINode
Node the Voximplant account belongs to. Find more information about VINode in the getting started guide.
gateways [String]?
Optional. Array of the media gateway servers for connection. The default value is an empty array.
completion @escaping (VIConnectionError?) -> Void
Completion handler to call when the connection is complete. This handler is executed on the delegate queue. The SDK passes a VIConnectionError object if the operation has failed
disconnect()
@objc func disconnect()
Disconnects from the Voximplant Cloud.
handlePushNotification(pushPayload:)
@objc func handlePushNotification(pushPayload: [AnyHashable : Any]) -> UUID?
Handles an incoming push notification.
Parameters
pushPayload [AnyHashable : Any]
Incoming notification which comes from pushRegistry(_:didReceiveIncomingPushWith:for:completion:)
Return Value
UUID that can be used as the CXCall.uuid for CallKit integration.
Can be called in any VIClientState, but to receive an incoming call instance, it is required to connect to the Voximplant Cloud and log in. After the login, the VICallManagerDelegate.callManager(_:didReceiveIncomingCall:withVideo:headers:) method is called to provide access to the VICall object.
login(withOneTimeKey:user:completion:)
@objc func login(
withOneTimeKey key: String,
user: String,
completion: @escaping (VILoginResult?, VILoginError?) -> Void
)
Logs in a user with a one-time key to the Voximplant Cloud.
Parameters
key String
Hash that has been generated via the following formula: MD5(oneTimeKey+"|"+MD5(user+":voximplant.com:"+password))
user String
Full user name, including app and account name, e.g., someuser@someapp.youraccount.voximplant.com
completion @escaping (VILoginResult?, VILoginError?) -> Void
Completion handler to call when the operation is complete. This handler is executed on the delegate queue. The SDK passes a VILoginResult object with the user display name and tokens if the operation has completed successfully, or a VILoginError object if the operation has failed
login(withPassword:user:completion:)
@objc func login(
withPassword password: String,
user: String,
completion: @escaping (VILoginResult?, VILoginError?) -> Void
)
Logs in a user with a password to the Voximplant Cloud.
Parameters
password String
User password
user String
Full user name, including app and account name, e.g., someuser@someapp.youraccount.voximplant.com
completion @escaping (VILoginResult?, VILoginError?) -> Void
Completion handler to call when the operation is complete. This handler is executed on the delegate queue. The SDK passes a VILoginResult object with the user display name and tokens if the operation has completed successfully, or a VILoginError object if the operation has failed
login(withToken:user:completion:)
@objc func login(
withToken token: String,
user: String,
completion: @escaping (VILoginResult?, VILoginError?) -> Void
)
Logs in a user with an access token to the Voximplant Cloud.
Parameters
token String
Access token. It is obtained either from auth, or via refreshTokens(forUser:refreshToken:completion:)
user String
Full user name, including app and account name, e.g., someuser@someapp.youraccount.voximplant.com
completion @escaping (VILoginResult?, VILoginError?) -> Void
Completion handler to call when the operation is complete. This handler is executed on the delegate queue. The SDK passes a VILoginResult object with the user display name and tokens if the operation has completed successfully, or a VILoginError object if the operation has failed
refreshTokens(forUser:refreshToken:completion:)
@objc func refreshTokens(
forUser user: String,
refreshToken: String,
completion: @escaping (VIAuth?, VILoginError?) -> Void
)
Performs a refresh of login tokens required for login(withToken:user:completion:).
Parameters
user String
Full user name, including app and account name, e.g., someuser@someapp.youraccount.voximplant.com
refreshToken String
Refresh token obtained via auth
completion @escaping (VIAuth?, VILoginError?) -> Void
Completion handler to call when the operation is complete. This handler is executed on the delegate queue. The SDK passes a VIAuth object with tokens if the operation has completed successfully or a VILoginError object if the operation has failed
registerIMPushNotificationsToken(_:bundleId:completion:)
@objc func registerIMPushNotificationsToken(
_ imToken: Data,
bundleId: String? = nil,
completion: @escaping (VIPushTokenError?) -> Void
)
Registers an Apple Push Notifications token.
Parameters
imToken Data
APNs token for IM push notifications
bundleId String?
Application bundle id. Set only if push notifications are going to be sent across several iOS apps via a single Voximplant application or if you add several push certificates. The default value is nil.
completion @escaping (VIPushTokenError?) -> Void
Completion handler to call when the operation is complete. This handler is executed on the delegate queue. The SDK passes a VIPushTokenError object if the operation has failed, otherwise the value is nil.
After calling this method, the application can receive push notifications from the Voximplant Cloud. If the client is not logged in, the token is to be registered just after login.
registerVoIPPushNotificationsToken(_:bundleId:completion:)
@objc func registerVoIPPushNotificationsToken(
_ voipToken: Data,
bundleId: String? = nil,
completion: @escaping (VIPushTokenError?) -> Void
)
Registers an Apple VoIP Push Notifications token.
Parameters
voipToken Data
APNs token for VoIP push notifications which comes from pushRegistry(_:didUpdate:for:)
bundleId String?
Application bundle id. Set only if push notifications are going to be sent across several iOS apps via a single Voximplant application or if you add several push certificates. The default value is nil.
completion @escaping (VIPushTokenError?) -> Void
Completion handler to call when the operation is complete. This handler is executed on the delegate queue. The SDK passes a VIPushTokenError object if the operation has failed, otherwise the value is nil.
After calling this method, the application can receive push notifications from the Voximplant Cloud. If the client is not logged in, the token is to be registered just after login.
requestOneTimeKey(forUser:completion:)
@objc func requestOneTimeKey(
forUser user: String,
completion: @escaping (String?, VILoginError?) -> Void
)
Generates a one-time login key to use in automated login process.
Parameters
user String
Full user name, including app and account name, e.g., someuser@someapp.youraccount.voximplant.com
completion @escaping (String?, VILoginError?) -> Void
Completion handler to call when the operation is complete. This handler is executed on the delegate queue. The SDK passes the one-time key if the operation is completed successfully or a VILoginError object if the operation has failed
For additional information please see the guide
unregisterIMPushNotificationsToken(_:bundleId:completion:)
@objc func unregisterIMPushNotificationsToken(
_ imToken: Data,
bundleId: String? = nil,
completion: @escaping (VIPushTokenError?) -> Void
)
Unregisters an Apple Push Notifications token.
Parameters
imToken Data
APNs token for IM push notification
bundleId String?
Application bundle id. Set only if push notifications are going to be sent across several iOS apps via a single Voximplant application or if you add several push certificates. The default value is nil.
completion @escaping (VIPushTokenError?) -> Void
Completion handler to call when the operation is complete. This handler is executed on the delegate queue. The SDK passes a VIPushTokenError object if the operation has failed, otherwise the value is nil.
After calling this method, the application cannot receive push notifications from the Voximplant Cloud. If the client is not logged in, the tokens are to be unregistered just after the login
unregisterVoIPPushNotificationsToken(_:bundleId:completion:)
@objc func unregisterVoIPPushNotificationsToken(
_ voipToken: Data,
bundleId: String? = nil,
completion: @escaping (VIPushTokenError?) -> Void
)
Unregisters Apple VoIP Push Notifications token.
Parameters
voipToken Data
APNs token for VoIP push notifications which comes from pushRegistry(_:didUpdate:for:)
bundleId String?
Application bundle id. Set only if push notifications are going to be sent across several iOS apps via a single Voximplant application or if you add several push certificates. The default value is nil.
completion @escaping (VIPushTokenError?) -> Void
Completion handler to call when the operation is complete. This handler is executed on the delegate queue. The SDK passes a VIPushTokenError object if the operation has failed, otherwise the value is nil.
After calling this method, the application cannot receive push notifications from the Voximplant Cloud. If the client is not logged in, the token is to be unregistered just after the login.
Relationships
Inherits From: NSObject
Conforms To: ObjectiveC.NSObjectProtocol, Swift.CVarArg, Swift.CustomDebugStringConvertible, Swift.CustomStringConvertible, Swift.Equatable, Swift.Hashable