VKSession

@objc
public class VKSession : NSObject

This class provides access to the account

Public Properties

  • Declaration

    Swift

    @objc
    public static let current: VKSession
  • The session token that is assigned to you by your backend (e.g. https://github.com/Video-io/vkit-nodejs)

    Declaration

    Swift

    @objc
    public var sessionToken: String?
  • The API token is assigned to you by http://panel.video.io/app-settings

    Declaration

    Swift

    @objc
    public var apiToken: String?
  • Allows client to start session using appSecretToken. Be careful only for testing purposes.

    Declaration

    Swift

    @objc
    public var secureModeEnabled: Bool
  • The application id that is assigned to you

    Declaration

    Swift

    @objc
    public var appID: String?
  • Account id assigned by gateway.video.io

    Declaration

    Swift

    @objc
    public var accountId: String?
  • Session is going to expire at date

    Declaration

    Swift

    @objc
    public var expiresAt: Date?
  • Session created at Date

    Declaration

    Swift

    @objc
    public var createdAt: Date?
  • Identity for current session

    Declaration

    Swift

    @objc
    public var identity: String
  • This describes the current account state of the session. A VKNotificationConstants.AccountStateChanged is sent when state are changed

    Declaration

    Swift

    @objc
    public fileprivate(set) var state: VKSessionState { get set }
  • This is the error that may have occured while trying to start a session.

    This is not nil if accountState == .Disconnected

    Declaration

    Swift

    @objc
    public fileprivate(set) var error: Error? { get }

Public Methods

  • Starts a session using global app token (insecure)

    Declaration

    Swift

    @objc
    public func start(apiToken: String, identity: String, completion: VKSessionStartCompletion?)
  • Starts the session. You could check on the state of session via accountState.

    Precondition

    Ensure devToken and appID are filled

    Declaration

    Swift

    @objc
    public func start(sessionToken: String)
  • Declaration

    Swift

    @objc
    public func startSession(completion: ((_ accountState: VKSessionState, _ err: Error?) -> Void)?)
  • Declaration

    Swift

    @objc
    public func stopSession()
  • Stops the session. You could check on the state of the session via accountState

    Declaration

    Swift

    @objc
    public func stop()