Sessions

public class Sessions

This class provides methods to connect to and logout from the established session against the server.

Properties

  • Information about current user

    Declaration

    Swift

    public var user: QNUser? { get }
  • Token for current session

    Declaration

    Swift

    public var sessionToken: String? { 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

Delegate

API

  • 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(token: String,
                        result: @escaping (Result<Void, ClientError>) -> Void)

    Parameters

    token

    Token authentication.

    provider

    Provider.

    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()
  • 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