Skip to content

Commit

Permalink
Enable XMPP stream resumption (#2257)
Browse files Browse the repository at this point in the history
* feat: Add a metric for XMPP disconnects.

* chore: Update jicoco to 1.1-148 (enable XMPP SM)
  feat: Add an endpointId field to StartEvent.
  feat: Move jwt utils from jibri into jicoco-jwt.
  chore: Update jitsi-metaconfig.
  Add Java 21 to GitHub testing matrix
  feat: Enables stream resumption.
  • Loading branch information
bgrozev authored Dec 5, 2024
1 parent 8b04b03 commit e2b6f4d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ object VideobridgeMetrics {
"Total duration of video received, in milliseconds (each SSRC counts separately)."
)

val xmppDisconnects = metricsContainer.registerCounter(
"xmpp_disconnects",
"The number of times one of the XMPP connections has disconnected."
)

private val tossedPacketsEnergyBuckets =
listOf(0, 7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 119, 127).map { it.toDouble() }
.toDoubleArray()
Expand Down
10 changes: 10 additions & 0 deletions jvb/src/main/kotlin/org/jitsi/videobridge/xmpp/XmppConnection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ import org.jitsi.nlj.stats.DelayStats
import org.jitsi.utils.OrderedJsonObject
import org.jitsi.utils.logging2.cdebug
import org.jitsi.utils.logging2.createLogger
import org.jitsi.videobridge.metrics.VideobridgeMetrics
import org.jitsi.videobridge.metrics.VideobridgeMetricsContainer
import org.jitsi.videobridge.xmpp.config.XmppClientConnectionConfig.Companion.config
import org.jitsi.xmpp.extensions.colibri.ForcefulShutdownIQ
import org.jitsi.xmpp.extensions.colibri.GracefulShutdownIQ
import org.jitsi.xmpp.extensions.colibri2.ConferenceModifyIQ
import org.jitsi.xmpp.extensions.health.HealthCheckIQ
import org.jitsi.xmpp.mucclient.ConnectionStateListener
import org.jitsi.xmpp.mucclient.IQListener
import org.jitsi.xmpp.mucclient.MucClient
import org.jitsi.xmpp.mucclient.MucClientConfiguration
Expand Down Expand Up @@ -64,6 +66,14 @@ class XmppConnection : IQListener {
registerIQ(GracefulShutdownIQ())
registerIQ(ConferenceModifyIQ.ELEMENT, ConferenceModifyIQ.NAMESPACE, false)
setIQListener(this@XmppConnection)
addConnectionStateListener(object : ConnectionStateListener {
override fun connected(mucClient: MucClient) {}
override fun closed(mucClient: MucClient) = VideobridgeMetrics.xmppDisconnects.inc()
override fun closedOnError(mucClient: MucClient) = VideobridgeMetrics.xmppDisconnects.inc()
override fun reconnecting(mucClient: MucClient) {}
override fun reconnectionFailed(mucClient: MucClient) {}
override fun pingFailed(mucClient: MucClient) {}
})
}

config.clientConfigs.forEach { cfg -> mucClientManager.addMucClient(cfg) }
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<kotest.version>5.9.1</kotest.version>
<junit.version>5.10.2</junit.version>
<jitsi.utils.version>1.0-133-g6af1020</jitsi.utils.version>
<jicoco.version>1.1-143-g175c44b</jicoco.version>
<jicoco.version>1.1-148-g3afa2ac</jicoco.version>
<mockk.version>1.13.11</mockk.version>
<ktlint-maven-plugin.version>3.2.0</ktlint-maven-plugin.version>
<maven-shade-plugin.version>3.6.0</maven-shade-plugin.version>
Expand Down

0 comments on commit e2b6f4d

Please sign in to comment.