From 11a413d2b65b760b8cc0cf95ce1f04fae93dbc6a Mon Sep 17 00:00:00 2001 From: Moepchi Date: Thu, 10 Sep 2026 17:11:44 +0000 Subject: [PATCH] Add requeststreaminfo so late joiners can find a running stream Verified end to end against a live TS6 client: the passthrough delivers notifyrespondjoinstreamrequest with the full SDP offer plus 18 iceCandidate notifies, all correctly unescaped. Getting there turned up a gap. A client entering a channel where a stream is already running receives no stream command at all - 35 s in the channel produced zero undeclared commands. Discovery runs over the ordinary client_is_streaming property instead, and the stream id has to be pulled per client with requeststreaminfo. Without that, only a viewer who happened to be present when the stream started could ever join. The unknown-command names now go to stderr, which is what made the difference between "the server sent nothing" and "we filtered it out" visible at all. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU --- connector/src/main.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/connector/src/main.rs b/connector/src/main.rs index 5925612..a30a4e5 100644 --- a/connector/src/main.rs +++ b/connector/src/main.rs @@ -1464,6 +1464,27 @@ async fn run(args: Args) -> Result<()> { } Err(e) => emit(&Event::Error { message: e.to_string() }), } + } else if let Some(rest) = l.strip_prefix("streaminfo ") { + // A late joiner only learns *that* someone streams, from + // the client_is_streaming property; the stream id has to + // be pulled per client with this. + match rest.trim().parse::() { + Ok(clid) => { + let mut packet = OutCommand::new( + Direction::C2S, + Flags::empty(), + PacketType::Command, + "requeststreaminfo", + ); + packet.write_arg("clid", &clid); + if let Err(e) = packet.send(&mut con) { + emit(&Event::Error { message: format!("requeststreaminfo failed: {e}") }); + } + } + Err(_) => emit(&Event::Error { + message: format!("Invalid client id: {rest}"), + }), + } } else if let Some(rest) = l.strip_prefix("streamjoin ") { // "streamjoin [msg]" - ask the client // publishing a TS6 stream to let us in. Its reply is a @@ -2470,6 +2491,10 @@ async fn run(args: Args) -> Result<()> { } } Some(Ok(StreamItem::UnknownCommand { name, content })) => { + // Undeclared commands are invisible everywhere else, so name + // them on stderr - that is the only way to tell "the server + // sent nothing" apart from "we filtered it out". + eprintln!("[unknown-command] {name}"); // TS6 Stream/Call signaling. Everything else undeclared is // dropped on purpose - forwarding every unknown command // would turn this into a firehose, and nothing downstream