Skip to content

webrtc and trystero: webcpp::webrtc built, trystero on it and refactored - #17

Merged
pinhopro merged 67 commits into
mainfrom
webrtc/library
Nov 16, 2026
Merged

pinhopro merged 67 commits into
mainfrom
webrtc/library

Conversation

@pinhopro

@pinhopro pinhopro commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The owner accepted webcpp::webrtc's proposal on 2026-11-14 (webcpporg/proposals#12) and asked for it to be finished natively and in the browser, then for trystero to move onto it and be refactored onto the project's own libraries. This branch registers all of it:

  • libs/webrtc at webcpporg/webrtc main: its three increments built (the interface and runtime, the native implementation over libdatachannel's C API, the browser implementation over the page's own objects through webcpp::asio's bridge), a data channel's ordered, max_packet_life_time, max_retransmits, protocol and negotiated, and the unsupported policy on both targets; its own lanes browser (headless Chrome) and interop (native against Chrome).
  • libs/trystero at trystero: on webcpp::webrtc, and refactored onto webcpp::asio, webcpp::document and Boost trystero#4: on webcpp::webrtc, one platform backend, webcpp::asio's run model in the page, std::chrono, JSON on webcpp::document in the room's resource, twins over a local relay (lane relayed), and the fixes the reviews found.
  • libs/document at document: quote, and allocators in the storages document#3: quote, and allocators in its storages (pmr::document).
  • libs/beast at beast: bound what a WebSocket client's handshake reads beast#2: bounded_handshake_stream, which bounds what a WebSocket client's handshake reads.
  • CODING-GUIDELINES.md: chapter 15's entries for webrtc, trystero, document and beast as built; chapter 18's bounded-parse draft marked superseded; chapter 19's open items updated (closed ones removed, new ones recorded).
  • Tools: the lint's clang-tidy analyses Boost.Unordered on arm64 hosts; twins.py lets a program without twin have no .expected; tools/openssl's combined provider over trystero's platform backend, with exceptions off; the CI matrix names webrtc's and trystero's own lanes. main's emscripten release-link fix (build: link emscripten programs at their compile's level of optimization #18) is merged in.

The library PRs above merge first; this branch records their commits.

Verification

From scratch, before publishing: webrtc, trystero, document and beast natively (with and without exceptions, and trystero with libstdc++), on WASI (document and beast), on emscripten (JSPI and Asyncify, debug and release, with and without exceptions), every browser lane in headless Chrome, both interop lanes, the oracles and twins, provider-integration, every page, the tools' tests, and the whole lint (clean). b2 check-release fails by design: 0.1.0 is frozen while six libraries hold Unreleased lines, an open decision of the owner.

🤖 Generated with Claude Code

R added 30 commits November 14, 2026 14:35
The owner accepted webcpp::webrtc's proposal on 2026-11-14
(webcpporg/proposals#12), so its summary leaves chapter 18 for chapter
15, as the library its increment 1 builds natively: the decisions of the
revised design, with what increment 1 measured. Reading a message
through libdatachannel's C API costs four allocations and four copies
inside libdatachannel, three to five times the C++ API's receive(), and
under 2% of the time the message takes to arrive on the loopback; the
design had estimated one copy and one allocation.

The roadmap says which increments remain. Chapter 19 keeps the design's
open questions O1 to O3 and adds two increment 1 found: dropping the
size probe of the native receive, and a received message past the local
maximum size, which libdatachannel truncates natively.
libs/webrtc is the submodule webcpporg/webrtc, by the relative URL
../webrtc.git as every library's, at its increment 1 (42509ec). AGENTS.md
lists webrtc among the libraries, and its layout names every submodule
of libs/, beast and cobalt included, which it had left out; the 0.1.0
release notes add webrtc under New Libraries.
main moved webrtc's summary from chapter 18 to chapter 17, accepted and
not built, and reworded chapter 18's introduction for drafts and
proposals under discussion alike. This branch builds increment 1, so,
as chapter 1 asks of a change that builds a proposal, the summary leaves
chapter 17 for chapter 15, where this branch already holds it, and its
open questions are chapter 19's; chapter 18 keeps main's introduction.
libs/webrtc moves to 6e96a83: the page no longer says that a channel
added to a connection that is up needs a new offer and answer, it states
its limits precisely, and the benchmark fails as a value on Windows too.
Chapter 19 says, as the page now does, that libdatachannel truncates an
oversized message silently, since webrtc installs no logger for it.
libs/webrtc moves to 12de0a4: webrtc runs in the browser too, over the
page's own RTCPeerConnection through webcpp::asio's bridge, in both
suspension variants, with exceptions on and off, and its page says so.

Its two own lanes meet a browser, so CHROME_LANES names them, as
matrix_test.py now pins: browser, two peers in one page of headless
Chrome, and interop, a native peer and a browser peer through a relay.
The interop lane runs with exceptions on and off, and in the page under
both unsupported policies (OWN_LANE_OPTIONS), and on emscripten its job
first builds the native peer the driver starts, as beast's browser lane
does. AGENTS.md lists the lanes and webrtc's targets, the 0.1.0 notes
say it runs in the browser, and chapter 15 holds increment 2: the
browser's design as built, its census, and the tests of both targets,
with Chrome 156's default-route candidates and dropped last messages.
The comment that names the browser lanes ran past the Python line limit
the lint keeps; libs/webrtc moves to the commit that keeps to the whole
lint's format and run rules.
…ys what it meets

The review of increment 2 found that the interop page sets nothing the
unsupported policy decides, so running it under both policies doubled
its job for no coverage; and AGENTS.md said webrtc's interop lane meets
a browser natively, where its native run is two native peers.
…ptions

Chapter 15's trystero entry records webrtc's increment 3: both backends'
WebRTC is one implementation over webcpp::webrtc behind the abstract
backend classes the memory relays implement; trystero's policies over it
(the merged states, the candidates' JSON, texts and oversized binaries
dropped on the executor, 64 frames for 10 s on both targets, the edge of
onbufferedamountlow); the browser's cap as the runtime's over
webcpp::webrtc's census; trystero's Asio named webcpp::asio, in both
suspension variants, in place of BOOST_ASIO_DISABLE_THREADS; the native
backend's runtime, its relay executor and its URLs libdatachannel cannot
parse; and every part working with exceptions on and off. Chapter 16's
webrtc bullet says increment 3 moved trystero; chapter 19 drops the
comments a trystero commit corrected and narrows the remaining migration
to the relays. AGENTS.md's trystero row and prerequisites drop the
exceptions native trystero no longer needs.
libs/webrtc moves to 1dd2d82: the fixes of increment 2's review (a
browser state that outlives its own shutdown, arrivals in their order,
texts that cross whole, one runtime in the reference, the empty remote
candidate) and of trystero's findings (clang-tidy, stuns: as a
difference). libs/trystero moves to 528a4e6: its backends' WebRTC on
webcpp::webrtc, native without exceptions, its page clean. AGENTS.md
says why trystero's reference keeps BOOST_ASIO_DISABLE_THREADS: its
native backend's Boost.Asio, read for a target with no threads.
wasi-sdk's clang-tidy, which reads the native commands, ships x86's
intrinsics headers alone, so on arm64 Boost.Unordered's open-addressing
containers stopped it at <arm_neon.h>, failing every native unit that
includes one, as trystero's core now does. A native command is now told
BOOST_UNORDERED_DISABLE_NEON on arm64 hosts, which reads Boost.Unordered's
portable path; lint_test.py's clang_tidy_reads_boost_unordered_on_every_host
failed on arm64 macOS before it and passes after, and the clean tree still
passes.
Tools and build lists what changes for whoever lints, and the lint now
analyses Boost.Unordered on arm64 hosts.
… now

trystero's native backend reaches libdatachannel through webcpp::webrtc's
C API and no longer brings its C++ API, so rtc::PeerConnection no longer
compiled here: the program makes its WebRTC state through the backend's own
peer connection and data channel, and checks that the backend's relay TLS
context, made without throwing over the system's authorities, comes from
the same OpenSSL provider.
Chapter 15's trystero entry takes the first phase of trystero's refactor:
the browser's main runs its io_context under a work guard and the page
calls C++ through browser::page_call; page events and Web Crypto come
through webcpp::asio's bridge and async_await; the native relays are one
callback-composed session over webcpp::beast, their URLs read with
Boost.URL, their trust the system's by default and their TLS context an
error value rather than a throw; the event-id set is keyed SipHash in a
boost::unordered_flat_set; an offer's size is a std::uint64_t. Chapter 19
drops the fixed trystero entries, corrects the relays' migration and the
type lines' places, and records what the phase leaves to others: asio's
citation of a removed trystero test and chapter 16's roadmap sentences.

combined_provider no longer asks for exceptions: trystero's native backend
throws nothing, and the program builds and runs with exception-handling=off,
linking Boost's handler as the other programs of this Jamfile do. The
superproject records trystero's refactor at its integration commit, with
the interop scenario of a public app beside a protected one fixed.
# Conflicts:
#	tools/openssl/test/Jamfile
webrtc wraps a comment of its browser lane within 80 columns; trystero's
relay session erases its reads' and writes' handlers' types, so that the
analysis of its Emscripten compile sees no cycle through Asio's post.
The superproject records trystero's refactor with the allocation test's
arenas left uninitialized, which took it from 105 s to 0.8 s under Asyncify.
The superproject records trystero's refactor with the allocation test's
arenas held as std::arrays, which the lint's clang-tidy accepts.
…hrono (WP5)

The superproject takes WP4's branch: tools/openssl's combined provider over
trystero's platform::backend and /webcpp/trystero//platform, and AGENTS.md's
reference sentence naming that target. libs/trystero records refactor at
71fc751, which holds WP5's merge and WP4's platform backend with both reviews'
fixes.
…:chrono (WP5)

Chapter 15's trystero entry takes the two work packages at trystero
71fc751. The browser and native backends become one platform::backend,
in sections for both targets, a page and natively: only the sealer and
the randomness are the target's own, by WEBCPP_TARGET_EMSCRIPTEN; the
randomness is checked wherever it is drawn; the window and the runtime
hold on both targets; the relays are one webcpp::beast session whose
failed write reports one close, whose URLs a page would read otherwise
fail closed, and whose TLS verifies the peer whatever the context's mode;
page_call checks the page's value and its resource outlives the
io_context. The core keeps its times as std::chrono and its integers at a
fixed meaning, and acts once only on NIP-01 event ids. Memory, the build,
the evidence and every source follow the new names and pages.

Chapter 6's example of a header that declares nothing without exceptions
named the removed webcpp::trystero::native: no library has one now, so
the fixture's error is given, as clang reports it. Chapter 4's and
chapter 17's sentences on trystero's two backends follow. Chapter 19
drops trystero's resolved type and shareability lines, records the
draft parse's outdated question, asio's building page on //native, the
allocation test's compiler macro, the quick starts, what is deferred,
and the seam's clocks, in progress.
libs/trystero records refactor at a0cfac5: every JSON text trystero reads or
writes goes through webcpp::document, read into an external document in a
buffer of the room's resource and written field by field with document's
quote. libs/document records its quote branch at d6a6d07, the public
JSON.stringify quoting trystero writes with.
… quote

Chapter 15's trystero entry takes WP7 at trystero a0cfac5: the protocol's
texts are written field by field with webcpp::document's quote and read
into an external document in a buffer of the room's resource, twice the
text and 4 KiB, doubled up to twice the caller's bound and 64 KiB; each
caller bounds its text (68,608, 66,560, 1,024 bytes and 16 KiB); the JSON
payload is webcpp::document::document or pmr_document; a self id that is
not UTF-8 becomes a random one. json_resource and the rooms' JSON storage
leave, the outside list names document's working state, and the
allocation test's bullet says what it now tracks. document's entry gains
quote.

Chapter 18 closes the bounded-parse draft as superseded, keeping its
record, and says how such a draft stays until its proposal is archived.
Chapter 19 drops that draft's discrepancies and records document's
working state as an open decision of the owner, document's measured cost,
and the inventory's understatement of that working state. AGENTS.md's
table names trystero's one platform backend.
The superproject takes WP6's branch: tools/oracle's twins.py lets a program
without twin have no .expected, as a linked one has none, with its failing-first
case and chapter 12's sentence, and AGENTS.md's trystero row names its own lanes,
the new relayed lane among them, beside the one platform backend. libs/trystero
records refactor at 62cb27a.
R added 6 commits November 15, 2026 03:40
Chapter 15's document entry takes the allocator change and its review
fixes, each bullet checked against document e95b409. Storage is
basic_owned or basic_external of any allocator of std::byte, with the
wd::pmr names; the allocator, rebound by construction, holds the owned
image, in 16-byte blocks of which a misaligned one is given back as
errc::capacity, and every operation's working state. An allocator's
failure is errc::capacity with exceptions, through
detail::unless_allocation_fails, the content as it was; anything else,
and any failure without exceptions, ends the program. A document is
allocator-aware as the standard containers are; most const reads ask
the allocator for nothing, and the page names those that do; the image
is the shareable type. A change its place cannot take is refused before
its value is prepared, and an erasure cannot run out of room. A whole
text never allocates Boost.JSON's stack, finish_with taking the last
chunk; stringify keeps its stack in its string's allocator, and the
writer its first 16 frames in room of its own. The allocator tests and
their allocators are the evidence. Boost.Interprocess's exceptions.hpp
joins the headers document includes.

Chapter 19 no longer says document has no Allocator parameter, nor that
its page leaves shareable types unsaid; the design discrepancies of the
staging and of stringify_to go, the genesis's D5 on the process heap
taking their place, and the examples are 22.
Chapter 15's trystero entry keeps run_case as the rule, which keeps a test's
cases out of main's frame whatever the link, and gives the measurements
under the link the Jamroot now gives a release program, -O3: the room,
app_impl and allocation tests' deepest suspensions write 564, 440 and 408
bytes in release and 2,344, 2,068 and 2,020 in debug, now the deepest
build, and a main with every case inlined fits at -O3. The release runs
stay as trystero's only runs under Asyncify in the CI's emscripten lane.
Chapter 19's "Emscripten's release link." is removed: the Jamroot's link
options fixed it (#18).
@pinhopro pinhopro changed the title webrtc: register the library, accepted, with its increment 1 built webrtc and trystero: webcpp::webrtc built, trystero on it and refactored Nov 15, 2026
R added 10 commits November 15, 2026 10:32
…builds without emscripten expand them

The CI's native lanes failed at once with b2's unknown feature <exception-handling-method>: webrtc's and trystero's targets naming <webcpp-suspend>asyncify were declared outside a lane, and asyncify composes a feature only the emscripten toolset defines. Both now form the own lane asyncify, as asio's and cobalt's do; AGENTS.md lists the lanes.
…ce does

Chrome can drop the presence a page sends as its answering channel opens, and Trystero JS sends it once per connection, so a room waiting for presence alone never bound the peer (the interop's two-rooms scenario, 3.3% on 2-CPU Linux). Chapter 15 now says a kept room frame is the peer's own advertisement.
MSVC's link writes the program and its .pdb in one action, which b2 records under the .pdb: a file no target the test needs, so a link-fail test's expected failure (webrtc's config_mismatch on msvc-14.3 and msvc-14.5) counted as a failure outside every test. A test's own directory, <location>/<target>.test/<toolset>/..., holds nothing of another test, so an action recorded under a file there belongs to the test. report_test moves native-failures' failing link to the program's .pdb: before, the test was 'not run' and the link outside every test; now it is the test's link failure. The CI's msvc-14.3 XML of #17 reads config_mismatch as a passing link-fail test.
R added 3 commits November 16, 2026 11:20
…ule and libsecp256k1 from third_party

main brought webcpp::crypto and webcpp::hash with their third-party sources, libsecp256k1 built by b2, the nodiscard results rule, and asio, beast, cobalt and trystero on their nodiscard branches. trystero is its refactor with main merged (c810bd6), document its main (b9d9e4f), beast and cobalt main's. CODING-GUIDELINES keeps this branch's trystero and webrtc text with main's libsecp256k1, crypto and hash: chapter 17's webrtc proposal stays out (it is built), its hash section comes in, and the getentropy guard trystero measured moves to crypto's random_device. tools/report keeps one rule for MSVC's .pdb: an action recorded under a file of a test's own directory is the test's, which covers main's .exe case and a program without one.
webrtc asks for it as the libraries it builds on do (CODING-GUIDELINES' lint table names it); trystero's refactor marks its four new result functions.
@pinhopro
pinhopro merged commit 76b1730 into main Nov 16, 2026
176 of 180 checks passed
@pinhopro
pinhopro deleted the webrtc/library branch November 17, 2026 04:05
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