Session

class Session(    userAgent: UserAgent,     options: UserAgent.RegisterInformation,     ccs: String,     apiKey: String?,     val context: Context,     apiRTCVersionName: String) : Emitter

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

Parameters

ccs

CCS URL

apiKey

Constructors

Link copied to clipboard
fun Session(    userAgent: UserAgent,     options: UserAgent.RegisterInformation,     ccs: String,     apiKey: String?,     context: Context,     apiRTCVersionName: String)

Types

Link copied to clipboard
data class CloudMediaInfo(val url: String, val id: String)

Cloud media info

Link copied to clipboard
object Companion
Link copied to clipboard
data class DataMessage(val sender: Contact, val content: String)

Data message

Link copied to clipboard
data class FileInfo(val name: String, val type: String)

File information

Link copied to clipboard
data class Message(    val sender: Contact,     val content: String,     val uuid: Int,     val time: Date = Date())

Instant message

Link copied to clipboard
data class PushDataBufferDescriptor(    var buffer: ByteArray,     val filename: String,     val filetype: String,     val overwrite: Boolean,     val ttl: Int)
Link copied to clipboard
data class TransferInformation(    val uuid: String,     val fileSize: Number,     val remainingSize: Number,     val percentage: Number,     val sendChunkNb: Number,     val transferDuration: Number,     val lastPacket: Boolean)

Transfer information

Functions

Link copied to clipboard
fun destroyConversation(name: String)
Link copied to clipboard
open fun emit(event: String, vararg args: Any): Emitter

Executes each of listeners with the given args.

Link copied to clipboard
fun getContacts(group: String? = null): ArrayList<Contact>

Returns contact list

Link copied to clipboard
fun getConversation(conversationName: String?): Conversation

Gets a conversation from name for N-N communication. Deprecated in favor of getOrCreateConversation().

Link copied to clipboard
fun getEnterpriseConfig(): JSONObject

Returns this session's enterpriseConfig

Link copied to clipboard
fun getIceServers(): String

Returns this session's iceServers

Link copied to clipboard
fun getId(): String

Returns this session's id

Link copied to clipboard
fun getOrCreateContact(id: String): Contact

Returns contact from id. Contact will be created if doesn't exist.

Link copied to clipboard
fun getOrCreateConversation(name: String, active: Boolean = true): Conversation

Gets or creates a conversation for a given name.

Link copied to clipboard
fun getPhotoUrl(): String?

Gets this session's photo URL

Link copied to clipboard
fun getUserData(): UserData

Gets user data for this user session

Link copied to clipboard
fun getUsername(): String

Gets this session's username

Link copied to clipboard
open fun hasListeners(event: String): Boolean

Check if this emitter has listeners for the specified event.

Link copied to clipboard
fun initSession(): Promise
Link copied to clipboard
fun joinGroup(group: String)

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

Link copied to clipboard
fun leaveGroup(group: String)

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

Link copied to clipboard
open fun listeners(event: String): MutableList<Emitter.Listener>

Returns a list of listeners for the specified event.

Link copied to clipboard
open fun off(): Emitter

Removes all registered listeners.

open fun off(event: String): Emitter

Removes all listeners of the specified event.

open fun off(event: String, fn: Emitter.Listener): Emitter

Removes the listener.

Link copied to clipboard
open fun on(event: String, fn: Emitter.Listener): Emitter

Listens on the event.

Link copied to clipboard
open fun once(event: String, fn: Emitter.Listener): Emitter

Adds a one time listener for the event.

Link copied to clipboard
fun setPhotoUrl(url: String)

Set session's photo URL

Link copied to clipboard
fun setUserData(userData: JSONObject)

Sets user data for this user session User data is visible from other users

Link copied to clipboard
fun setUsername(username: String)

Set session's username

Link copied to clipboard
fun subscribeToGroup(group: String)

Subscribe to a group and know who is present in the group Unless you also joined the group, the user will not be visible to others within this group

Link copied to clipboard
fun unsubscribeToGroup(group: String)

Unsubscribe to a group, the session will no longer receive events from user joining and leaving this group

Properties

Link copied to clipboard
val context: Context
Link copied to clipboard
val sessionId: Long