Skip to content

fix: don't close peer connection on transient 'disconnected' state - #250

Merged
jmattheis merged 1 commit into
screego:masterfrom
swindi-dev:fix/transient-disconnected
Aug 20, 2026
Merged

fix: don't close peer connection on transient 'disconnected' state#250
jmattheis merged 1 commit into
screego:masterfrom
swindi-dev:fix/transient-disconnected

Conversation

@swindi-dev

Copy link
Copy Markdown

Hi 😊
both connectionstatechange handlers treated 'disconnected' the same as 'closed' and 'failed' and immediately called peer.close().

Per the WebRTC spec, 'disconnected' only means that ICE connectivity checks are currently failing. The connection frequently recovers on its own -- brief network hiccups ☺️, Wi-Fi roaming between access points, or NAT rebinding all trigger it. Calling close() makes that recovery impossible, because a closed RTCPeerConnection cannot be reopened.

The result was that a short network glitch permanently killed the stream and the viewer had to reload the page. Leaving 'disconnected' unhandled lets the browser's own ICE recovery do its job.

Refs #53

Both connectionstatechange handlers treated 'disconnected' the same as
'closed' and 'failed' and immediately called peer.close().

Per the WebRTC spec, 'disconnected' only means that ICE connectivity checks
are currently failing. The connection frequently recovers on its own -- brief
network hiccups, Wi-Fi roaming between access points, or NAT rebinding all
trigger it. Calling close() makes that recovery impossible, because a closed
RTCPeerConnection cannot be reopened.

The result was that a short network glitch permanently killed the stream and
the viewer had to reload the page. Leaving 'disconnected' unhandled lets the
browser's own ICE recovery do its job.

Refs screego#53
@jmattheis
jmattheis force-pushed the fix/transient-disconnected branch from d1f2b39 to 9f87229 Compare August 20, 2026 18:25

@jmattheis jmattheis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, will be released shortly.

@jmattheis
jmattheis merged commit 7dec440 into screego:master Aug 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants