chore(audio-rooms): post-moq-lite cleanup + KDoc + plan refresh

Tidy items now that the moq-lite swap is complete on both sides:

  - Drop the no-op `supportedMoqVersions: List<Long>` parameter from
    `connectNestsListener` / `connectNestsSpeaker`. moq-lite negotiates
    via ALPN, no caller passed a value, and the project rule forbids
    no-op back-compat shims.
  - `NostrNestsRoundTripInteropTest` KDoc + comments now describe the
    moq-lite framing path (one Subscribe bidi for `audio/data`, group
    uni streams with `DataType=0` + GroupHeader + size-prefixed frames)
    instead of the stale IETF "OBJECT_DATAGRAMs / SETUP" framing.
  - `DefaultNestsListener` / `DefaultNestsSpeaker` KDoc now flags them
    as IETF MoQ-transport reference impls — production uses
    `MoqLiteNests*`. They stay around for the IETF unit-test suite.
  - `audio-rooms-completion.md` Phase M5 / M6 / M7 marked **DONE** —
    the plan was written before the moq-lite gap was discovered, so
    it described the work as IETF-MoQ-publisher additions; the
    moq-lite path lands the same outcome via a different protocol.
This commit is contained in:
Claude
2026-04-26 18:18:33 +00:00
parent 71cf99dc22
commit bc43168032
5 changed files with 69 additions and 43 deletions
@@ -22,7 +22,6 @@ package com.vitorpamplona.nestsclient
import com.vitorpamplona.nestsclient.audio.AudioCapture
import com.vitorpamplona.nestsclient.audio.OpusEncoder
import com.vitorpamplona.nestsclient.moq.MoqVersion
import com.vitorpamplona.nestsclient.moq.SubscribeHandle
import com.vitorpamplona.nestsclient.transport.WebTransportException
import com.vitorpamplona.nestsclient.transport.WebTransportFactory
@@ -55,10 +54,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
* @param signer NIP-98 signer for the mintToken HTTP call.
* @param scope where the moq-lite pumps live (typically the caller's
* ViewModel scope so they cancel when the screen leaves).
* @param supportedMoqVersions retained for source-compatible callers but
* currently a no-op — moq-lite negotiates via ALPN, not an in-band
* SETUP message. Will be repurposed to drive ALPN preference once a
* second moq-lite version ships.
*/
suspend fun connectNestsListener(
httpClient: NestsClient,
@@ -66,7 +61,6 @@ suspend fun connectNestsListener(
scope: CoroutineScope,
room: NestsRoomConfig,
signer: NostrSigner,
supportedMoqVersions: List<Long> = listOf(MoqVersion.DRAFT_17),
): NestsListener {
val state =
MutableStateFlow<NestsListenerState>(
@@ -112,10 +106,8 @@ suspend fun connectNestsListener(
state.value = NestsListenerState.Connecting(NestsListenerState.Connecting.ConnectStep.MoqHandshake)
// moq-lite Lite-03 has NO setup message — the WebTransport handshake
// itself is the handshake, version is selected by ALPN. The
// `supportedMoqVersions` parameter is retained for backward compat
// with callers that may want to gate on a version mismatch in
// future, but it is currently a no-op.
// itself is the handshake, version is selected by the ALPN
// `moq-lite-03`.
val moq =
try {
com.vitorpamplona.nestsclient.moq.lite.MoqLiteSession
@@ -185,7 +177,6 @@ suspend fun connectNestsSpeaker(
speakerPubkeyHex: String,
captureFactory: () -> AudioCapture,
encoderFactory: () -> OpusEncoder,
supportedMoqVersions: List<Long> = listOf(MoqVersion.DRAFT_17),
): NestsSpeaker {
val state =
MutableStateFlow<NestsSpeakerState>(
@@ -231,8 +222,7 @@ suspend fun connectNestsSpeaker(
state.value = NestsSpeakerState.Connecting(NestsSpeakerState.Connecting.ConnectStep.MoqHandshake)
// moq-lite Lite-03 has NO setup message. Same logic as the listener
// path — `supportedMoqVersions` retained for backward compat but
// currently a no-op because version is selected by ALPN.
// path — version is selected by the `moq-lite-03` ALPN.
val moq =
try {
com.vitorpamplona.nestsclient.moq.lite.MoqLiteSession
@@ -99,12 +99,16 @@ sealed class NestsListenerState {
}
/**
* Default [NestsListener] implementation that delegates to a [MoqSession]
* already set up on a [com.vitorpamplona.nestsclient.transport.WebTransportSession].
* IETF `draft-ietf-moq-transport-17` [NestsListener] reference
* implementation. **Not used in production** — the production listener
* path uses [MoqLiteNestsListener] over moq-lite Lite-03 (see
* `nestsClient/plans/2026-04-26-moq-lite-gap.md`). Kept for the IETF
* unit-test suite (`MoqSession`, `MoqCodec`) and for any future IETF
* MoQ-transport target.
*
* Construction does NOT open the transport — call [connectNestsListener] to
* walk the full HTTP + transport + MoQ handshake; this class just owns the
* resulting session and exposes the listener API on top.
* Delegates to a [MoqSession] already set up on a
* [com.vitorpamplona.nestsclient.transport.WebTransportSession];
* construction does NOT open the transport.
*/
class DefaultNestsListener internal constructor(
private val session: MoqSession,
@@ -115,11 +115,16 @@ sealed class NestsSpeakerState {
}
/**
* Default [NestsSpeaker] that wraps a connected [MoqSession] and plumbs an
* [AudioRoomBroadcaster] through it on [startBroadcasting].
* IETF `draft-ietf-moq-transport-17` [NestsSpeaker] reference
* implementation. **Not used in production** — the production speaker
* path uses [MoqLiteNestsSpeaker] over moq-lite Lite-03 (see
* `nestsClient/plans/2026-04-26-moq-lite-gap.md`). Kept for the IETF
* unit-test suite (`NestsSpeakerTest`) and for any future IETF
* MoQ-transport target.
*
* Construction does NOT open the transport — call [connectNestsSpeaker] to
* walk the full HTTP + transport + MoQ handshake.
* Wraps a connected [MoqSession] and plumbs an [AudioRoomBroadcaster]
* through it on [startBroadcasting]. Construction does NOT open the
* transport.
*/
class DefaultNestsSpeaker internal constructor(
private val session: MoqSession,