JitsiConnection represents a connection to the Jitsi Meet XMPP server. It handles authentication, connection management, and provides access to conferences.
Constructor
new JitsiConnection()
Creates a new connection instance.string
required
Application identifier for the Jitsi Meet service. For JaaS deployments, use your
vpaas-magic-cookie-* app ID.string | null
required
JWT token for authentication. Can be
null for guest access.object
required
Connection configuration options
Connection Management
connect()
Connects to the XMPP server.object
Connection options
attach()
Attaches to an existing XMPP connection (for connection reuse).object
required
disconnect()
Disconnects from the XMPP server.Promise<void> | boolean
Promise that resolves when disconnection is complete, or boolean for synchronous result
refreshToken()
Renews the JWT token if it’s expiring.string
required
The new JWT token
Promise<void>
Promise that resolves when token is refreshed
Conference Management
initJitsiConference()
Creates and initializes a new conference.string
required
Conference room name (must be lowercase)
object
Conference configuration options. See JitsiConference for details.
JitsiConference
A new JitsiConference instance
Event Management
addEventListener()
Subscribes to connection events.string
required
Event name from
JitsiMeetJS.events.connectionfunction
required
Event handler function
CONNECTION_ESTABLISHED- Connection successfully establishedCONNECTION_FAILED- Connection failed(error: string, msg: string, credentials: object, details: object)CONNECTION_DISCONNECTED- Connection was disconnected(msg: string)WRONG_STATE- Connection is in wrong state for the operation
removeEventListener()
Unsubscribes from connection events.string
required
Event name to unsubscribe from
function
required
The event handler to remove
Information Methods
getJid()
Returns the JID of the participant associated with the connection.string
Full JID of the connected participant (e.g.,
user@domain/resource)getConnectionTimes()
Returns connection timing information for diagnostics.object
Object containing connection timing metrics:
connecting- When connection startedconnected- When connection was established- Various XMPP-specific timings
getLogs()
Retrieves internal connection logs for debugging.object
Object containing:
metadata- Connection metadata (time, URL, user agent)xmpp- XMPP protocol logs- Jingle session logs
Feature Management
addFeature()
Adds a feature to the local participant’s capabilities.string
required
Feature URN to add (e.g.,
urn:xmpp:jingle:apps:dtls:0)boolean
default:"false"
If
true, immediately broadcast the updated feature listremoveFeature()
Removes a feature from the local participant’s capabilities.string
required
Feature URN to remove
boolean
default:"false"
If
true, immediately broadcast the updated feature list