Sessions
public class Sessions
This class provides methods to connect to and logout from the established session against the server.
-
Information about current user
Declaration
Swift
public var user: User? { get }
-
True if an active session can be restored
Declaration
Swift
public var canRestoreSession: Bool { get }
-
Session identifier for signaling server
Declaration
Swift
public var sessionId: String? { get }
-
True when sippo server and media server are connected and authenticated
Declaration
Swift
public var isAuthenticated: Bool
-
Connects the session and notify
ClientStateDelegate
when it finishes, onSuccess is called if it’s all OK or onFailure(ErrorType) if an error occurs.Declaration
Swift
public func connect(authentication: SippoServer.Authentication, result: @escaping (Result<Void, ClientError>) -> Void)
Parameters
authentication
Token authentication, Basic authentication (user/password) or Anonymous.
result
Result with success when actions is completed
-
Restore an active session that had been activated before. (Call canRestoreSession to check if exist an active session)
Declaration
Swift
public func restoreSession(result: @escaping (Result<Void, ClientError>) -> Void)
Parameters
result
Result with success when actions is completed
-
Destroys the session established against the server.
Declaration
Swift
public func disconnect(result: @escaping (Result<Void, ClientError>) -> Void)
Parameters
result
Result with success when actions is completed
-
Suspend session, should be called when app enters background
Declaration
Swift
public func suspend()
-
Fetch configured oauth providers in server
Declaration
Swift
public func providers(result: @escaping (Result<[[String : String]], ClientError>) -> Void)
Parameters
result
Result with providers in case of success
-
Register a new push token in server
Declaration
Swift
public func registerAPNS(_ token: String, production: Bool = true, result: @escaping (Result<Void, ResourceError>) -> Void)
Parameters
token
Token to save
production
Use production or debug apn gateway
-
Check if a permission is granted in current session
Declaration
Swift
public func isPermissionGranted(_ permission: Permission) -> Bool
Parameters
permission
Permission to be checked