go2rtc icon indicating copy to clipboard operation
go2rtc copied to clipboard

Closing connection to a client

Open Erithax opened this issue 1 year ago • 3 comments
trafficstars

A go2rtc stream stays open for 5 seconds (default timeout) even if a client closes the connection properly on their end (i.e. RTCPeerConnection.close() is called).

Problems this could cause:

  • (my case) because switching between streams of different cameras causes two streams to temporarily both be active, which overloads the USB hub the 2 cameras are connected through.
  • (made up) on a page with live-thumbnails-on-hover, hovering over 10 thumbnails momentarily opens 10 streams for 5 seconds

If this answer is correct, WebRTC does not support a closing a peer connection by a peer message, only by timeout. Lowering this timeout causes unwanted disconnections.

Could go2rtc provide a way to close a connection?
Automatically sending it over e.g. the WebRTC datachannel would be awesome, but I understand if the user is responsible for the messaging to the server.

Erithax avatar Oct 04 '24 07:10 Erithax

This is a heavy complication of the protocol and not a standard. There are already many clients to go2rtc. They will not be able to support this without improvements on their part.

AlexxIT avatar Oct 06 '24 05:10 AlexxIT

Yeah. I would be looking for a way to call e.g. CloseClientById via IPC with the go2rtc binary (since I guess most go2rtc users aren't Go users).

But if you don't want to support something like this, I understand. For now I'm killing Go2rtc and starting it back up as a workaround. I just wish WebRTC supported this :/

Erithax avatar Oct 07 '24 07:10 Erithax

Drop client via REST API is a good improvement. Maybe someday when I have time.

AlexxIT avatar Oct 07 '24 10:10 AlexxIT