Skip to content

Feature add close signaling - #807

Open
WANGXIAOMIN-HIK wants to merge 5 commits into
developmentfrom
feature_add_close_signaling
Open

Feature add close signaling#807
WANGXIAOMIN-HIK wants to merge 5 commits into
developmentfrom
feature_add_close_signaling

Conversation

@WANGXIAOMIN-HIK

Copy link
Copy Markdown
Contributor

The ONVIF WebRTC specification lacks an explicit stream close signaling mechanism, leading to resource waste, difficult state management, state inconsistency, and degraded user experience. It is recommended to add this mechanism so clients can actively notify devices to stop streaming, release resources promptly, enable platforms to accurately track session lifecycles, and improve system performance and user experience.

WANGXIAOMIN-HIK and others added 3 commits July 22, 2026 09:55
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
The trickle section's closing note discusses terminating the WebSocket
session and states the only reason to keep the connection is to extend.
With the new close command, there is a second reason: to actively release
device resources (ICE candidates, TURN connections) before teardown. Point
readers to section_close.

Co-Authored-By: Claude <noreply@anthropic.com>
@jcadev

jcadev commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Typically web browser clients can be closed at any moment, it's normal for a human to just close a browser tab, and then the client just stops, it isn't able to send any "close" command. So a camera must be able to deal with this, with timeouts and such, and detect that a client has disappeared, and then free local resources. It's not reliable to only free resources when a "close" is received. And with such automatic freeing implemented, is there any need for a "close" command?

Comment thread doc/WebRTC.xml
signaling server shall return a successful response rather than 404, so a client
can retry safely after a network interruption. The 404 fault applies only when the
session ID was never valid.</para>
</section>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would also be helpful to clarify the expected behavior if a trickle or extend command is received for an already closed session—specifically, whether the signaling server should return a 404 Not Found fault or silently drop/ignore the message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

trickle: Returns success but does not forward (avoids flooding the client with errors, consistent with idempotent design).
extend: Returns 404 (clearly signals the session has ended, preventing "ghost sessions").

@WANGXIAOMIN-HIK

Copy link
Copy Markdown
Contributor Author

@jcadev Automatic reclamation is the mandatory foundation; close is an optimization for prompt, graceful termination and explicit intent. They are complementary, not interchangeable.The spec (section_close in specs/doc/WebRTC.xml) now states this explicitly: close is an optimization, and devices and signaling servers shall still implement timeout- and disconnection-based cleanup as a fallback, since a client may disappear without sending close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants