Skip to content

trystero: on webcpp::webrtc, and refactored onto webcpp::asio, webcpp::document and Boost - #4

Merged
pinhopro merged 146 commits into
mainfrom
refactor
Nov 16, 2026
Merged

pinhopro merged 146 commits into
mainfrom
refactor

Conversation

@pinhopro

Copy link
Copy Markdown
Contributor

Summary

trystero moves onto webcpp::webrtc for its WebRTC on both targets, and is refactored onto the project's own libraries, as the owner directed on 2026-11-14: asynchronous work on webcpp::asio, every JSON text on webcpp::document, Boost where it fits, and CODING-GUIDELINES.md throughout. The wire stays Trystero 0.26.0's byte for byte (the oracle and the interop lanes against Trystero JS prove it).

  • One platform backend, platform::backend, for native and the page, replacing native:: and browser::: one relay session over webcpp::beast (natively through its bounded handshake layer), Boost.URL, TLS verified in any verify mode, entropy checked on both targets, backend_config::memory.
  • webcpp::asio's run model in the page: main runs its io_context under a work guard; the page calls in through platform::page_call; no JavaScript exception enters WebAssembly.
  • Types of a fixed meaning and std::chrono in the core and at the backend seam (steady_now(), unix_now()).
  • JSON on webcpp::document: every text read into a webcpp::document::pmr::document of the room's resource within its bound; payloads webcpp::document::document / webcpp::document::pmr::document; room_options::max_json_document_bytes.
  • Guarantee 5 holds without exception: the allocation test sees zero global allocations for every exchange and protocol text, natively and on emscripten.
  • Fidelity evidence: twins on Trystero 0.26.0 over a local relay (lane relayed), one deterministic quick start, twelve diff_ programs beside their twins.
  • Fixes found on the way: a relay hiding a genuine Nostr event, negotiations evicted while their offer was being opened, offers piling up in one peer's name, a release Asyncify build's stack, flaky timing tests moved to the virtual clock.

Breaking changes are listed in doc/changelog.adoc (Unreleased). The superproject records this branch in webcpporg/webcpp#17.

Verification

From scratch: native with and without exceptions, libstdc++ (gcc 15), emscripten JSPI and Asyncify with and without exceptions, release Asyncify, the oracle with its twins, relayed, interop with Trystero JS natively (30 scenarios) and in Chrome (26), provider-integration, the page, and the whole lint.

🤖 Generated with Claude Code

R added 30 commits November 14, 2026 15:36
…ceptions

The backend's peer connection and data channel are now one implementation
over webcpp::webrtc for both targets (include/webcpp/trystero/webrtc/),
holding webrtc::basic_peer_connection and basic_data_channel over a
polymorphic allocator on the app's resource. native/peer_connection.hpp and
native/data_channel.hpp, over libdatachannel's C++ API, are gone.

trystero's policies stay over it, on the executor: text messages and
binaries larger than a room frame are dropped after async_receive, frames
no handler has read wait in a FIFO of 64 frames for 10 s, the connection
and ICE states are merged, the per-minute window stays the native
backend's. The native backend owns a webcpp::webrtc runtime, or uses the
program's, and every connection and channel keeps it alive. A URL
libdatachannel cannot parse is still left out, as before.

The native backend no longer needs exceptions: build.jam names
/webcpp/webrtc//webrtc, and native_peer_connection and native_room also
run with exception-handling=off.
…::asio

The browser backend's peer connection and data channel, and its census of
the page's connections, are gone: it makes the same connection over
webcpp::webrtc as the native backend, whose browser runtime counts the
page's connections against browser::backend::max_peer_connections (256),
now runtime_options::max_peer_connections of the runtime it owns.

webcpp::webrtc's browser objects deliver through webcpp::asio's bridge, a
service of their executor's io_context, so trystero names Asio as
webcpp::asio throughout what builds on emscripten: natively it is
Boost.Asio itself, unchanged; on emscripten it is webcpp::asio's backend,
which browser::event_loop polls as before. /webcpp/trystero//trystero
brings /webcpp/asio//asio, and /webcpp/webrtc//webrtc on emscripten,
instead of BOOST_ASIO_DISABLE_THREADS: a program on emscripten is built in
webcpp::asio's two suspension variants, jspi and asyncify.

The tests whose main runs the io_context end with
webcpp::test::exit_status, which a main that suspended under Asyncify
needs; the allocation test counts Asyncify's unwind data apart, as
webcpp::asio's own allocation test does. browser_peer_connection and
browser_data_channel test the backend's WebRTC over webcpp::webrtc's
browser objects, with a page's RTCPeerConnection of their own under node.
The chat site copies the program webcpp::asio names after its variant as
chat-program.js. The interop native peer and the native example no longer
ask for exceptions.
…metadata

The page's backends, design, building, allocation and testing say what the
backends' WebRTC is now: webcpp::webrtc's, on both targets, with
trystero's policies over it (the merged states, the dropped texts and
oversized binaries, the 64 frames and 10 s, the per-minute window, the
runtime's cap), and no exception asked for natively. The Unreleased lines
name what a user sees; meta/libraries.json, which has no field for a
dependency, names webcpp::webrtc in its description; AGENTS.md records the
backend interface kept for the memory relays, webcpp::asio on emscripten
and the runtime.
A refused send no longer arms the drain's wait, an empty brace list and a
positional session_description_view are written out, and the browser
backend's runtime options take their trailing comma. The native peer
connection test's mixed pair is a fixture of its own, its queued pair
opens with open(), whose destructor says why it raises nothing, and the
allocation test keeps Asyncify's counters to emscripten.
The guide's reference reads every header for Emscripten's target, where
webcpp::asio is not Boost.Asio: the native backend's executor, timer and
sealer now name webcpp::asio, which natively is Boost.Asio itself, and its
relays' Boost.Beast WebSockets get the same executor through
relay_executor, which names none for that parse alone. Three Doc Comments
keep their brief to one sentence, a possessive no longer follows a code
span, and backend.hpp says which resource a peer connection and its frames
are in: the app's.
…h a keyed Hash2, circular_buffer, one random_id

The action wire and the envelope read and write their big-endian fields with
Boost.Endian, and an offer's size is read in 64 bits: on a 32-bit target an
offer of 2^53 - 1 bytes was read as 4294967295 (measured on Emscripten).
The strategy's event-id dedup is a boost::unordered_flat_set hashed with
SipHash under a key it draws, so ids a relay chose to share a bucket of
std::hash cost one probe each. The construction window, the recent challenges
and the replay cache are boost::circular_buffer rings. One protocol::random_id
maps random bytes to Trystero's characters, in place of four copies and the
unused make_id. Comments cite Trystero's dist/ files instead of C/, error.hpp
names app::on_error, and differences.adoc no longer says as today.
…t.URL

The relay WebSocket is one session over webcpp::beast's stream, natively
Boost.Beast's own, composed of Asio operations whose handlers carry the
room's allocator instead of coroutines, so that no coroutine frame and no
read buffer stays outside the room's resource; it compiles for Emscripten
too, where webcpp::beast's page stream keeps its state in the room's
resource. A relay's URL is read with Boost.URL: an IPv6 address reaches the
resolver without its brackets, which made such a relay unreachable, a
scheme in capitals is a WebSocket's, and userinfo and fragments are refused
as a page refuses them. SNI goes through webcpp::beast and names a host name
only.

The backend's constructors throw nothing: native::make_tls_context makes
its context, TLS 1.2 or newer over the system's authorities, as a result,
and a backend may take the program's own, webcpp's embedded roots among
them; one that holds an error keeps it in tls_context() and its wss://
relays report a close. The relay_executor bridge goes, since the session
names webcpp::asio's executor on both targets.
A page's program now runs its io_context from main, under a work guard, as
webcpp::asio's model asks: browser::event_loop, browser/js.hpp and
browser/src.hpp are gone, and nothing polls the io_context from a
JavaScript event. browser::backend takes the io_context's executor; the
page's WebSocket events reach it through webcpp::asio's bridge, Web
Crypto's promises through browser::async_await, made in an async function
so that a synchronous throw becomes a rejection, and its timer is the new
detail::timer over webcpp::asio's steady_timer, whose waits are numbered so
that one cancelled, restarted or destroyed never fires. A failed
getentropy now fails the seal, and ends the program in random(), as the
native backend does.

The browser tests run their io_context from main and end with
webcpp::test::exit_status; browser_event_loop goes, its subject now
asio's bridge and run family. New: timer, on both targets, and
browser_page, whose work guard keeps a page with no room running and
whose exports, called while run is suspended, only post and reach the
room. The examples and the interop's browser peer run from main, their
page calls posting to the io_context.
The browser backend's page describes the program webcpp::asio's model
asks for: main runs the io_context under a work guard, the page's events
reach C++ through webcpp::asio's bridge and only post, Web Crypto's
promises are awaited with browser::async_await, the timers are
webcpp::asio's, and the page's calls into C++ post too, as the chat's
join and send now do. The quick start, the overview, the testing chapter
(browser_page and timer in, browser_event_loop out) and the README follow.
make_tls_context sets the verification and reads the system's authorities
through OpenSSL itself, as webcpp::asio's make_tls_client_context does,
since Asio's error-code forms also return the code, which
bugprone-unused-return-value refuses to discard. The read loop and the
writes are loops of asynchronous operations, not recursions: each of their
functions states its exemption from misc-no-recursion, with the reason
above. The test's TLS server keeps what its callbacks record mutable, so
that a test may hold it const.
…scripten

The session chose OpenSSL's TLS context, SNI, the certificate check and the
keep-alive pings when the target is native, and the page's when it is
Emscripten. It now chooses the page's on Emscripten alone, as webcpp::asio's
make_tls_client_context does, since every other target of webcpp::beast
runs OpenSSL in the program.
The bracketed address is appended in three statements, as the lint's rule
against chains of three calls asks, and the url_parts host's Doc Comment
keeps its closing line to itself.
Under Asyncify an embind function called while main is suspended in its
run returns a promise that never settles, and its second call aborts a
debug build (measured with Emscripten 6.0.11): the interop's browser peer
failed its two leaving scenarios there, window.leave() never answering,
and the chat aborted at its second message. browser::page_call is a
function of webcpp::asio's bridge that the program hands to the page;
each call posts its work, with the value the page passed, and returns at
once in either variant, and a call of one destroyed meanwhile reaches
nothing. The chat's main now owns the chat and hands the page joinRoom
and sendText, the interop peer's main defines window.leave, and
browser_page drives both calls from JavaScript, twice in a row.

The backend's constructors take their executor by value, as clang-tidy
asks, and two comments no longer name a clock or the run family.
wp1: the browser's own event loop, js.hpp and src.hpp go; a page's main
runs its io_context under a work guard, the page's events reach C++
through webcpp::asio's bridge, the page calls C++ through
browser::page_call, which posts, Web Crypto is awaited with async_await,
and one detail::timer runs on webcpp::asio's steady timer.
The page's doc-check refuses C++ that no example or tagged test region
holds: the backend made with webcpp's embedded Mozilla roots is a case of
native_websocket now, which shows the test authority's relay unreachable
through those roots, and the page includes its tagged lines. The handshake
host takes its single characters as characters.
wp2: one relay session over webcpp::beast's WebSocket, callback-composed
with the room's allocator; relay URLs through Boost.URL, IPv6 relays
fixed; SNI for host names only; the system's authorities through a
non-throwing make_tls_context, or the program's context, embedded roots
included; no constructor throws.
…ions

The interop scenario of a public app beside a protected one, in both id
orders, counted every connection the public app made and failed when the
count grew between its snapshot before the page's injection and the one
after: natively 4 of 59 runs at a load average of 51 to 178 failed so,
always with the protected app the higher id and "cppMade" 1, then 2. The
two apps share the public app's first room, and whatever the passwords the
lower id offers to a higher one it sees announced, as Trystero JS does: the
public app, when it has the lower id, makes a connection for the protected
app when they meet, and another each time its unanswered offer expires
(57 s). The three peers started together, so the two apps met a few hundred
ms from the first snapshot, on either side of it, though the public app's
connection with the page never changed.

The protected app now joins once the public connection is up and the first
snapshot taken, and the scenario waits until the two apps met (the higher
id could not open the lower id's offer or candidate), so that the public
app's connection for the protected app falls inside the window in every
run. The check counts the negotiations the public app opened with the page,
by its log (the offers it sent the page, the page's offers it answered), and
fails when there is none before, and the page still holds one connected
connection. Natively, in batches that ran each variant at once under 100
busy loops (load average 250 to 340), the restructured scenario with the
old check failed 20 of 20 runs, "cppMade" 1, then 2, with one negotiation
with the page before and after, and with the new check passed 20 of 20;
beside the old scenario at a load average of 72 to 178 it passed 45 of 45.
In headless Chromium, where the count is Chromium's, the old check failed 4
of 4 runs the same way and the new one passed 4 of 4.
native::backend and browser::backend become platform::backend, in
include/webcpp/trystero/platform/, built through /webcpp/trystero//platform
on both targets: webcpp::webrtc, webcpp::beast's relay session (in a page
over its WebSocket, bounded by queue_limits::send), detail::timer,
std::chrono clocks, and per target only the sealer and one checked source
of randomness. backend_config::memory holds the backend's own state. A
page's page_call and js_string are in platform/page.hpp. The tests become
platform_* tests on each target that builds them.
The hand-over texts of the browser on webcpp::asio's run model, the native
relays on webcpp::beast with Boost.URL and the core on Boost reach the files
no package owned: AGENTS.md (the page's names on the wire, the browser's
bridge, page_call and work guard, the relay session and its TLS, the Boost
containers, the keyed event-id set, what stays outside the resources),
design.adoc, allocation.adoc, overview.adoc, building.adoc, testing.adoc,
README.md and build.jam's comment. The changelog's Unreleased holds the
three packages' lines and the WebRTC move's in ten, breaking changes first.

test/Jamfile compiles native/websocket.hpp alone on emscripten too, against
webcpp::beast's browser implementation and Boost.URL, so that the lanes
prove the relay session compiles there. The reference no longer defines
BOOST_ASIO_DISABLE_THREADS: the native backend's Asio and Beast are
webcpp::asio and webcpp::beast, and the page builds without it. The provider
lane no longer asks for exceptions, which the backend no longer needs, and
two tests cite Trystero's dist/ files rather than C/.
…ines/libs/trystero into wp4

# Conflicts:
#	build.jam
#	doc/Jamfile
#	test/Jamfile
Every time the core keeps is a std::chrono::steady_clock::time_point
(detail::time_point) and every delay a std::chrono::milliseconds: the
Nostr strategy's cadence, backoff and reconnection bound, the signaling's
last message, replays, counter-announcements and failed-open reports, the
action wire's waiting frames, a ping's start and the construction window.
The numbers are Trystero's, as before, and the wire does not change.

The backend's clocks reach the core only through detail/clock.hpp:
steady_now and unix_now convert the seam's now_ms and unix_seconds, so
that the seam's own types change in one place. construction_window keeps
a take(double) for a backend's own window until then.

A Nostr kind is a std::uint32_t, and an event's created_at and a
subscription's since a std::chrono::sys_seconds, in
protocol::nostr::topic_kind, event_id, event_message and
subscribe_message. The signaling's offer retries count in std::uint32_t,
the announce attempt in std::size_t, and the failed-open report's "never"
is an empty optional rather than minus infinity.
The protocol's hexadecimal and base64 digits are std::uint32_t with a
sentinel for a character that is none, rather than an int of -1; a
sealed signal's IV byte is read as a std::uint8_t, whose from_chars
refuses a number above 255 as before; the action wire's format nibble is
shifted as a std::uint32_t. The doubles that stay are JavaScript's
Numbers, which str_to_num, the UTF-16 sum and the relay shuffle now say.

The room tests count in std::size_t and std::int64_t, and the memory
backend's time scale is a std::uint32_t and its refusal knobs
std::size_t.
…ckend

doc/platform.adoc's page is the one backend's; every page, the README and
AGENTS.md name platform::backend, /webcpp/trystero//platform and the
platform_* tests, say that no type is meant for a shared segment and that
backend_config::memory holds the backend's own state, and the changelog's
ten lines lead with the breaking rename.
… said

construction_window, recent_challenges and replay_cache hold a
boost::circular_buffer over a std::pmr allocator, which moves by swapping
its allocator, which std::pmr's cannot: they reported themselves
move-constructible and failed to compile when moved. Their moves are
deleted.

random_id's tip said an id is as unpredictable as its bytes. A character
carries about 5.95 bits, and byte % 62 favours the first eight
characters, where Trystero draws each alike.
A relay could send 4096 events with distinct ids of nearly 1 MiB each,
about 4 GiB kept in the room's resource. recent_event_ids now remembers
only an id of 64 lowercase hexadecimal digits, NIP-01's; an event with
any other id is acted on every time, as Trystero 0.26.0, which has no
dedup, acts on every event, and its id is never stored. The id is read
in protocol/nostr.hpp's relay-message parsing, which is left as it is.

The collision search, about 8.4 million hashes, passed even with a hash
that ignored its key. It is replaced by two cases: the keyed hash gives
an id another value under another key, and a strategy draws its 16-byte
key from the backend's randomness, which the memory backend now counts.
A third case checks that the holders of a pmr circular buffer do not
move. Each failed first: the first against the dedup as it was, the
second and third against a hash and a strategy made to ignore the key,
the last against the moves before they were deleted.

The reconnection share reads its two random bytes with Boost.Endian.
The appendix "Differences" records the dedup and random_id's bias.
…'s context

Asio makes a client's context with verify_none, and the session's host
name verification callback does not change the mode, so a program's
context that names its authorities with load_verify_file or
add_certificate_authority but sets no verify mode accepted any
certificate for any name. Natively the session now sets verify_peer on
each stream before the TLS handshake, with the error_code overload, and
reports a close if it fails, as a page's WebSocket always verifies. The
program's context is left as it is.
detail::openssl_error() read the queue with ERR_get_error, the earliest
error, which may be one an earlier call left behind, and left the rest
queued. It now reads ERR_peek_last_error and empties the queue, and
make_tls_context empties it before its first call.
R added 18 commits November 15, 2026 01:09
memory_network::time_scale ran the memory backend's timers and its
steady_now a given number of times faster than the wall clock. No test
sets it any more: the six cases of room that did, the flood test and the
five of the commit before, now run on the virtual clock, since a case on
a scaled wall clock fails when the process pauses, as chapter 15
records. A timer of the memory backend that is not on the virtual clock
now waits its delay, and steady_now is the time since the network was
made, so that a timing case has only the virtual clock to use.
forged_offers_make_no_connection ran 200 ms of wall clock "for the
opens" and then found no connection made, which held as well when the
opens had not run. With a planted defect, an offer that does not open
acted on, it failed idle (1 connection), but with each copy stopped
(SIGSTOP) for random spans of up to 1.5 s between runs of 10 ms it
passed 47 runs of 48: the 200 ms ended before the opens, and the one
failure was its wait for the relay. It now counts the offers the room
could not open, which the room logs once each, waits until it has every
one, and then finds no connection: with the defect it fails every run,
48 of 48 under the same pauses. The offers come twenty at a time, each
twenty refused before the next comes 1 ms later, so that the id that
evicts a negotiation evicts one already refused: sent at one instant, a
later id evicts the first in id order among those idle as long, whose
offer may still be opening, and the room drops that offer unopened.

the_same_password_joins_and_another_does_not waited a fixed 1500 ms of
wall clock for the intruder to be refused. Under the same pauses it
failed 21 runs of 48: the intruder had refused nothing yet, so its
reports were empty. Its comment said both sides report the intruder;
only the intruder reports, since A and B, lower, offer to it and it
cannot open their offers. It now waits until the intruder has reported
both, the first at once and the other with its interval's report, 10 s
later. A planted room key without the password, which the room's
password proof still refuses after a connection, passed the old case and
fails the new one, which checks that the key keeps the intruder out
before it connects.

counter_announcements_are_paced held asked <= 1 + elapsed / 5.333 s on
the clock the room reads, which is consistent, but its strength was the
machine's: idle, the flood took less than 5.3 s, so the case checked
only that the room asked once, and an interval of 1 s or one that asks
again only after 5.333 s passed it. Under the pauses its 10 s wait for
the relay failed 26 runs of 48. On the virtual clock the interval is
checked at its end, exactly: a flood of 300 at once asks once, a fresh
id 5332 ms later asks nothing, and one at 5333 ms asks again. Both
planted intervals fail it, as does no pace at all, which the old case
caught too.

Under load alone, 24 copies of the three at once beside 80 busy loops (a
load of 125 to 180), the old and the new cases passed 96 runs of 96, and
with pauses of up to 0.5 s between runs of 20 ms 48 of 48. With pauses
of up to 1.5 s between runs of 10 ms, the old ones failed 33 runs of 48
and the new ones none of 48.
A room holds at most 32 negotiations with peers it is not connected to,
and a new peer beyond them took the place of the one idle longest. A
negotiation counted as idle as soon as it held no connection, so also
while the sealer was still opening its peer's offer, an asynchronous step
(Web Crypto in a page). At one instant, which a page's coarse clock makes
of close arrivals, every negotiation had been idle as long as any other,
and the tie went to the first in id order: new ids arriving while honest
offers were being opened took their places, and the room dropped those
offers unopened, with no log. Measured on the memory backend's virtual
clock: two peers offering while 32 new ids announced joined only 2 s
later, on their offer sent again; 33 to 64 honest peers joining a room at
once had 31 answered at once instead of 32; and 200 forged offers from
fresh ids at one instant were all opened at once, 168 of them dropped
unaccounted for.

A negotiation is now idle only when it holds no connection and no offer
of its peer is being opened (negotiation::offers_opening); of those idle
as long, the one the room took first gives its place
(negotiation::admitted), whatever the ids. An opened offer finds its
negotiation by that order too, so an open that outlived its negotiation
(the peer left, or the room closed) changes nothing. The bound keeps its
purpose under a flood: the offers opened at once come from at most 32
peers, and every other new id is refused at the bound and logged.

The memory backend can hold its sealers' opens (hold_sealer_opens,
release_sealer_opens, held_sealer_opens), as Web Crypto's take their time
in a page. room's an_offer_being_opened_keeps_its_place and
a_flood_of_offers_at_one_instant_is_bounded failed before the change; the
case of forged offers now sends its batches at one instant, with no
clock moved between them. The bound is written in protocol.adoc, the
testing page and AGENTS.md.
…lease under Asyncify

Under Asyncify, b2's release build, compiled with -O3 and linked without
optimization, saves every local of every frame from main down at each
suspension, in webcpp::asio's 8,192 bytes. -O3 inlined the room test's
cases into its main, which saved 29,776 bytes at each suspension, so that
the test stopped at its first; app_impl's main saved 8,884 bytes, and
allocation's main and largest case 7,788 together.

A room's own work is never on that stack, since it runs in handlers
between the run's waits: in that build the chat's two pages suspended at
most 1,292 bytes deep, the interop page 2,344 and the page tests 1,660, so
the library asks for no more than webcpp::asio's 8,192.

A test whose cases suspend now runs each through webcpp::test::run_case
(test/cases.hpp), which is never inlined and calls the case through a
pointer, so that main holds none of their locals. The deepest suspensions
in release become 3,096, 2,140 and 5,592 bytes, and the room test runs in
22 s rather than 200 s. room_asyncify_release, app_impl_asyncify_release
and allocation_asyncify_release run the three in that build; each stopped
at its first suspension before.
With the flood test and five timing cases on the virtual clock, the room
test still takes 54 s of the processor under Asyncify in a debug build,
more than a third of node's default bound of 120 s, and 74 to 168 s on a
loaded machine (18 cores at load averages of 50 to 230), past it; under
JSPI 34 s, and 44 to 51 s. The bound stays at 300 s, with the new
measurement beside it.
The room test's main runs refactor's two new cases,
an_offer_being_opened_keeps_its_place and
a_flood_of_offers_at_one_instant_is_bounded, through run_case as it runs
every other, so that none is inlined into main. In release under Asyncify
the room test's deepest suspension still writes 3,096 bytes of
webcpp::asio's 8,192.
Every offer sent in a peer's name while none was answered started an
open of its own, each holding its copy of the offer, up to 64 KiB, in the
room's resource until it completed: the bound on negotiations bounded the
peers whose offers were opened at once, not the offers, which only the
relays' rate bounded. Measured on the memory backend: 40 offers of 48 KiB
in one name at one instant held 42 opens and 1,976,152 bytes, and the
same offer again through the other relay made an open that was then
dropped, so the answer went through the first relay alone.

Trystero 0.26.0 answers one offer of a peer at a time: handleOffer makes
its answering peer before it decrypts the offer, and while it answers, an
offer that is not the same is ignored, and the same one records its relay
for the answer (dist/signal-handler.mjs:264-323). A negotiation now does
the same. It opens one offer at a time, keeping its id, its sealed text
and the relays it came through (negotiation::opening_offer), and the
open's handler holds no copy of its own; while it is opened, the same
offer through another relay adds that relay, where the answer goes too,
and any other offer in that name is ignored. As with Trystero, a forged
offer opened first has the peer's own, arriving meanwhile, wait until the
peer sends it again, 2 s later (measured).

room's offers_in_one_name_are_opened_one_at_a_time failed before the
change: 42 opens, 1,976,152 bytes, the answer through one relay. The
flooder of the tests can now use the second relay and give a signal a
nonce. The honest-peer case's comment now says what its four opens are,
two offers and two candidates: a signal comes through both relays as one
event, which the room acts on once. Setting up the answer moves from
on_offer_opened to start_answer, within the lint's cognitive complexity.
The room test's main runs every case through run_case, the case of offers in one name among them.
Unreleased merges the refactor's lines into ten, breaking changes first:
the one platform backend, webcpp::asio, document's two JSON payload types,
the relays' stricter TLS, URLs and binary messages, the backend's
std::chrono clocks and the protocol's functions; then the relays' and
offers' attacks fixed, max_json_document_bytes and the bounded JSON
texts, the other fixes, and the examples with their twins. Changes made
and undone within the refactor, as pmr_document and the 256-deep payload
under Asyncify, are left out, since no release had them.
The superproject now links an emscripten release program at its compile's
level, -O3, where b2 linked it without optimization. Measured again on
2026-11-15 with Emscripten 6.0.11, the deepest suspensions of the room,
app_impl and allocation tests write 564, 440 and 408 bytes in release, and
2,344, 2,068 and 2,020 in debug, now the deepest build; a room in a page
needs at most 1,032 bytes in debug (the chat's pages), 920 (the interop
page) and 1,600 (the page tests), and 328, 348 and 384 in release.

run_case stays the rule: it keeps the cases' locals out of main's frame
whatever the link. With main calling its cases directly, the release
runs pass at -O3 (616, 496 and 400 bytes), so they no longer catch an
inlined main, which still stops the room test at its first suspension
when linked with <linkflags>-O0 (33,580 bytes). They stay as trystero's
only programs that the CI's emscripten lane, building JSPI, runs under
Asyncify, in the build a page ships. The texts say so, and give the
unoptimized link as history where the reason needs it.
MrDocs drops the colon that follows a reference, and the lint's Doc
Comments rule refuses one. The first platform::backend constructor's
TLS context is make_tls_context's, which natively verifies relays
against the system's authorities, now after a comma; payload_traits'
decode reads a message with the room's decoding, and the view types'
lifetime is a sentence of its own.
… parsed

/webcpp/trystero//trystero links -sASYNCIFY_REMOVE=@asyncify-remove.json
under Asyncify, whose pattern names Boost.JSON's basic_parser<...>::parse_*.
A test of a part that parses no JSON (timer, platform_websocket_url,
platform_page_call, platform_page_sealer, platform_page_sealer_allocation
and their twins without exceptions) has none of those functions, and
Binaryen warned at each link that the pattern matched nothing.

build.jam now declares parts, trystero's headers and dependencies, and
platform-parts, the backend over parts; trystero is parts and the list,
and platform is platform-parts and trystero, so every program of the
rooms keeps the list, and a page's first 256-deep payload still fits a
debug build's stack. The tests of those parts link parts or
platform-parts in place of the project's trystero ($(part) and
$(platform-part) in test/Jamfile), and their links print nothing. The
guide's building and testing chapters and AGENTS.md say so.
R added 8 commits November 15, 2026 10:32
A target that names <webcpp-suspend>asyncify composes <exception-handling-method>js, a feature only the emscripten toolset defines, so declared outside a lane of emscripten's it stopped every build with no emscripten configured, the CI's native lanes among them.
…diff example reads alike over libstdc++

The handle's destructor abandons its session, which cancelled the resolver: Asio's cancel allocates a new cancellation token, so clang-tidy over libstdc++ found bad_alloc escaping the destructor (bugprone-exception-escape). abandon() no longer cancels; on_resolve drops a resolution's result once closing, as before. The diff_json_refused example takes its channel by rvalue reference and keeps its moved connection non-const with the reason.
…ce does

A room bound a peer over a shared connection only once the peer's
presence for the room had come on that connection. Trystero sends a
room's presence once per connection, from the open of its channel, and
Chrome can drop what a page sends on an answering channel as it opens:
in the interop lane's delayed-open scenario, run in 2-CPU Linux
containers, Chrome logged "Send failed INVALID_STATE" for both presence
frames and the native peer's SCTP received neither, 8 runs of 240. The
room whose own connection the page closed as the second then never
bound: the page's frames of that room were kept and expired, and its
announcements were claimed by the live connection and bound nothing.
That is the CI failure of webcpporg/webcpp#19.

A room frame of a local room's token that the connection keeps now
records the token as the remote's advertisement, below the bound of 64
tokens (a frame never ends the connection for a 65th), and the room
binds on it. Only the peer writes to its connection, so a forged
announcement still binds nothing. Without the change, connection's
a_kept_frame_advertises_its_token fails, and so do shared's
a_lost_presence_is_replaced_by_the_peers_frames, which replaces
binding_needs_the_peers_own_presence, and
frames_before_presence_bind_their_room, which replaces
frames_before_presence_are_kept; connection's
a_kept_frame_never_advertises_a_65th_token holds the bound. A kept @_leave
still discards what came before it where a room keeps frames without
binding, during the lower id's refusal, which
a_kept_leave_discards_what_came_before now sets up. The scenario then
passed 480 runs of 480 in the same containers.
MSVC's debug STL allocates a proxy for each container when it is constructed or moved, through the container's allocator: the protocol test's refusals made before reading and the platform backend's moved address counted them. test/bookkeeping.hpp measures that block once, on an empty std::pmr::vector, as document's tests do, and both tests leave it out.
…_party build, and the nodiscard results rule

main took libsecp256k1 from /third_party//secp256k1 and asked for the nodiscard results rule, app::join [[nodiscard]]. The refactor keeps its parts, trystero and platform targets, parts naming /third_party//secp256k1 in place of the external installation; AGENTS.md, README.md and the docs keep the refactor's text with main's account of libsecp256k1; the changelog's Unreleased folds main's two lines into one and the clocks into the backend's line, within ten.
…rd]]

main asked for the nodiscard results rule; the refactor's platform backend added four such functions: tls_context, make_tls_context, peer_connection::make and make_connection.
An apostrophe after a code span ('std::chrono's') becomes Asciidoctor's typographic one and joins two spans, which the rendered check refuses.
@pinhopro
pinhopro merged commit 08b9b00 into main Nov 16, 2026
4 of 27 checks passed
@pinhopro
pinhopro deleted the refactor branch November 17, 2026 04:06
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