ApiRTC iOS SDK Documentation

Class Session

open class Session: Observable<SessionEvent>  

Session represent the connected environment of an UA. It's created after UA registration.

Session Session Descriptable Descriptable Session->Descriptable Observable<SessionEvent> Observable<SessionEvent> Session->Observable<SessionEvent>

Conforms To

Observable<SessionEvent>

Properties

id

open private(set) var id: String! 

connection​State

open private(set) var connectionState: SessionConnectionState = .offline  

Session connection state

external​Camera​State

open var externalCameraState: ExternalCameraState  

Methods

get​Token()

open func getToken() -> String?  

Returns this session's token if this is a cloud user's session, otherwise returns null

join​Group(_:​)

open func joinGroup(_ group: String)  

Joins and subscribes to the group The user will be visible to both users inside the group and users who subscribed to it

leave​Group(_:​)

open func leaveGroup(_ group: String)  

Leaves and unsubscribes to a group Users within the group and users who subscribed to it will be notified

get​Contact(id:​)

open func getContact(id: String) -> Contact  

Returns contact with id

get​Contacts(group:​)

open func getContacts(group: String? = nil) -> [Contact]?  

Returns contact for a given group

get​OrCreate​Conversation(name:​)

open func getOrCreateConversation(name: String) throws -> Conversation  

Gets or creates a conversation for a given name Public conversation name format is alphanumeric Private conversation name format is alphanumeric:alphanumeric

get​OrCreate​Conversation(url:​)

open func getOrCreateConversation(url: String) throws -> Conversation  

Gets or creates a conversation for a given url, convenient if the application handles links. Url should have correct format: Public conversation: http(s)://example.com/conversationId(alphanumeric) Private conversation: http(s)://example.com/private/enterpriseId(alphanumeric)/conversationId(alphanumeric)

get​Active​Conversations()

open func getActiveConversations() -> [Conversation]?  

Gets all currently joined conversations

join​Conversation​Space(_:​)

open func joinConversationSpace(_ space: String)  

send​Raw​Data(contact:​data:​)

open func sendRawData(contact: Contact, data: [String: Any])  

get​Active​Session()

open class func getActiveSession() -> Session?  

Returns currently active session

get​User​Agent()

open func getUserAgent() -> UserAgent  

Returns session's UserAgent

on​Event(_:​_:​)

open override func onEvent(_ observer: AnyObject, _ callback: @escaping ((SessionEvent) -> Void))