Skip to content

feat: add high-level client API - #396

Closed
devopvoid wants to merge 5 commits into
mainfrom
client-api
Closed

devopvoid wants to merge 5 commits into
mainfrom
client-api

Conversation

@devopvoid

@devopvoid devopvoid commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Adds dev.onvoid.webrtc.client, a pure Java layer over the existing API:

  • A WebRtc runtime that owns the factory and everything created through it; closing it closes all in order. No dispose() in the API.
  • Peers negotiate by themselves with perfect negotiation, through a pluggable Signaling and browser-compatible JSON messages. Manual negotiation for WHIP/WHEP and SFUs.
  • One event thread per peer for handlers and future callbacks, never a WebRTC thread. Waiting on a future from an event thread throws BlockingCallException instead of deadlocking.
  • Local media (camera, microphone, screen, pushed audio and video), remote tracks with frame drop policies, data channels with backpressure, stats.

No native changes. Also in this PR:

  • Design doc (design/client-api.md), a guide page and ClientApiExample.
  • The web example ported to the client API, with the browser client reusing its connection on renegotiation and WebSocket sends queued.
  • fix: the web example server failed every request since the Jetty 12.1 bump (build(deps): bump the maven-dependencies group with 3 updates #370); its handlers now sit in a root context.

Adds dev.onvoid.webrtc.client: a WebRtc runtime that owns the factory and
everything created through it, peers with built-in perfect negotiation,
futures instead of nested observers, and one event thread per peer that
never runs on a WebRTC thread. Pure Java, no native changes.
The guide covers the runtime, signaling and perfect negotiation, threads,
media, data channels, manual negotiation, stats and closing. The example
connects two peers in one process without hardware or a server.
A video sink owns the reference to each frame it gets. The dispatcher
retained it once more, so every delivered frame leaked, and frames that
arrived after a subscription closed were never released.
Jetty 12.1 needs a context around the handlers; without one every page and
WebSocket request failed with a NullPointerException. The WebSocket upgrade
handler now wraps the static content inside a root context.
The Java client is a peer of the client API, with SignalingManager as its
Signaling over the example's own message format. A new peer calls the
browser whenever it joins. WebSocket sends are queued, since a WebSocket
takes one at a time, and the browser reuses its connection when the Java
side renegotiates.
@devopvoid devopvoid changed the title Add high-level client API feat: add high-level client API Oct 18, 2026
@devopvoid devopvoid closed this Oct 18, 2026
@devopvoid
devopvoid deleted the client-api branch October 18, 2026 23:12
@devopvoid

Copy link
Copy Markdown
Owner Author

Superseded by #397, the same commits on the renamed branch feat/client-api.

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.

1 participant