In the current explainer, both peerdiscovery and acceptance of incoming connections (peerB.accept();) is handled in JavaScript.
I wanted to highlight the approach that the Presentation API takes here. Instead of handling this in JavaScript, it's the User Agent that takes up this task. This is also similar to how ChromeCast-ing or bluetooth pairing works. This has the following potential advantages:
It avoids sharing the full list of discovered peers with the JavaScript context. This can be considered a privacy improvement.
A user explicitly chooses which peer is shared with the JavaScript context.
A user explicitly accepts an incoming connection before it is shared with the JavaScript context.
It gives the user agent the opportunity to authenticate a connection before it is passed to the JavaScript context (E.g. using a pre-shared pin code as done in the OpenScreen Protocol).
It leaves the user agent the opportunity to retain the authentication context for longer so the user doesn't have to re-establish it over-and-over.
In the current explainer, both
peerdiscovery
and acceptance of incoming connections (peerB.accept();
) is handled in JavaScript.I wanted to highlight the approach that the Presentation API takes here. Instead of handling this in JavaScript, it's the User Agent that takes up this task. This is also similar to how ChromeCast-ing or bluetooth pairing works. This has the following potential advantages: