You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: EXPLAINER.md
+22-23Lines changed: 22 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# Local Peer-to-Peer API Explained
2
2
3
-
The Local Peer-to-Peer API enables browsers to connect securely over the Local Area Network, without the aid of a server in the middle.
3
+
The Local Peer-to-Peer API enables browsers to connect securely over a [local communication medium](https://wicg.github.io/local-peer-to-peer/#local-communication-medium), without the aid of a server in the middle.
4
4
5
-
The API provides a powerful new building block for developers while ensuring a seamless, secure and privacy preserving experience for the user. By putting the user-agent in control during discovery and authentication, bare minimal network topology information is exposed to an origin.
5
+
The API provides a powerful new building block for developers while ensuring a seamless, secure and privacy preserving experience for the user. By putting the user-agent in control during discovery and authentication, bare minimal [communication medium topology](https://wicg.github.io/local-peer-to-peer/#communication-medium-topology) information is exposed to an origin.
6
6
7
7
Please refer to the [specification](https://WICG.github.io/local-peer-to-peer/) for the the formal draft spec.
8
8
@@ -16,13 +16,13 @@ This proposal sets to make a part of this Tim's vision a reality while adhering
16
16
17
17
### Goals
18
18
19
-
Build a generic Local Peer-to-Peer API and provide an arbitrary bidirectional channel on the web for devices under short-range communication environment, including:
19
+
Build a generic Local Peer-to-Peer API and provide an arbitrary bidirectional communication channel to the web for devices in the context of a [local communication medium](https://wicg.github.io/local-peer-to-peer/#local-communication-medium), including:
20
20
21
-
- Methods to discover, request, and connect to peers on the local network
21
+
- Methods to discover, request, and connect to peers on the local communication medium
22
22
- Listeners to notify if these method calls succeed or fail
23
23
- Listeners to notify if the connection is received or its status is updated
24
24
- Means to send and receive data after connection to a peer device has been established
25
-
- Means to enable secure HTTPS connections on the local network
25
+
- Means to enable secure HTTPS connections on the local communication medium
26
26
27
27
As a commitment to an open standards-based implementation path, this specification describes how the API can be implemented on top of the [Open Screen Protocol](https://w3c.github.io/openscreenprotocol/). While not described here, the API is expected to be implementable on top of other transports when technically feasible.
28
28
@@ -40,7 +40,7 @@ As a commitment to an open standards-based implementation path, this specificati
40
40
41
41

42
42
43
-
Figure 1: Collaborate from nearby devices in Google Doc
43
+
Figure 1: Collaborate using local communication in Google Doc
44
44
45
45
### UC2: Disaster relief
46
46
@@ -81,20 +81,19 @@ Figure 3: Play web game cross smart TV and mobile phone
81
81
82
82
The following are the high-level requirements derived from the use cases:
83
83
84
-
- R1: Discover nearby device(s)
85
-
- R2: Advertise yourself to nearby device(s)
86
-
- R3: Establish a bi-directional communication channel between two nearby devices
87
-
- R4: Allow secure connection to locally hosted web pages.
84
+
- R1: Discover device(s) on the local communication medium
85
+
- R2: Advertise yourself to device(s) on the local communication medium
86
+
- R3: Establish a bi-directional communication channel between two devices on the local communication medium
87
+
- R4: Allow secure connection to web pages hosted on the local communication medium.
88
88
- R5: User consent and delegation per web origin.
89
89
90
90
### Prerequisites
91
91
92
-
What is a prerequisite for all these use cases is that the participating devices are physically nearby to each other and as such able to establish a direct connection using either a wireless connectivity technology such as Wi-Fi Direct, Wi-Fi via access point, or a wired computer networking technology such as Ethernet. This connection technology and its details are abstracted out by both the Web API exposed to web developers as well as the UI/UX visible to the user.
92
+
What is a prerequisite for all these use cases is that the participating devices can be connected via a [local communication medium](https://wicg.github.io/local-peer-to-peer/#local-communication-medium) because they are physically nearby to each other and as such able to establish a direct connection using either a wireless connectivity technology such as Wi-Fi Direct, Wi-Fi via access point, or a wired computer networking technology such as Ethernet. This connection technology and its details are abstracted out by both the Web API exposed to web developers as well as the UI/UX visible to the user.
93
93
94
94
In summary, the following are the prerequisites:
95
95
96
-
- The participating devices are physically nearby (the definition of "nearby" is an implementation detail)
97
-
- The participating devices are able to establish a direct connection using some connection technology (the supported technologies may vary depending on hardware and OS capabilities and remain an implementation detail)
96
+
- The participating devices share a local communication medium.
98
97
99
98
### References
100
99
@@ -107,14 +106,14 @@ In summary, the following are the prerequisites:
107
106
108
107
## Solution Approach
109
108
110
-
The Local Peer-to-Peer API uses the to mutual authentication provided by the Open Screen Protocol to establish mutual TLS certificates between peers. These certificates serve as a trust anchor for secure communication. The Local Peer-to-Peer specification defines two uses of this new trust anchor:
109
+
The Local Peer-to-Peer API uses the to mutual authentication provided by the Open Screen Protocol to establish mutual TLS certificates between peers. These certificates serve as a trust anchor for secure [local communication](https://wicg.github.io/local-peer-to-peer/#local-communication). The Local Peer-to-Peer specification defines two uses of this new trust anchor:
111
110
112
-
1. Enabling HTTPS on the local network.
113
-
2. Enabling data communication on the local network using the `DataChannel` and `WebTransport` APIs.
111
+
1. Enabling HTTPS on the local communication medium.
112
+
2. Enabling secure local communication using the `DataChannel` and `WebTransport` APIs.
114
113
115
114
### API Design
116
115
117
-
Peer-to-Peer communication starts with service discovery. For this purpose, the LP2PReceiver API allows an origin to advertise itself. The LP2PRequest API allows discovery of a peer on the network. The design if these APIs is inspired by the work of the Presentation API's PresentationRequest & PresentationReceiver. Data exchange itself is provided by two APIs: `LP2PDataChannel` & `LP2PQuicTransport`. The [LP2PDataChannel API](https://wicg.github.io/local-peer-to-peer/#lp2p-data-channel) is inspired by the RTCDataChannel API. This API caters to simple message passing use-cases and developer familiar with WebRTC. The API design augments that of the WebRTC RTCDataChannel API. The [LP2PQuicTransport API](<](https://wicg.github.io/local-peer-to-peer/#lp2p-quic-transport)>) design is inspired by the WebTransport API. This API is designed for use-cases where more direct control over the underlying transport is preferred.
116
+
Peer-to-Peer communication starts with service discovery. For this purpose, the LP2PReceiver API allows an origin to advertise itself. The LP2PRequest API allows discovery of a peer on the local communication medium. The design if these APIs is inspired by the work of the Presentation API's PresentationRequest & PresentationReceiver. Data exchange itself is provided by two APIs: `LP2PDataChannel` & `LP2PQuicTransport`. The [LP2PDataChannel API](https://wicg.github.io/local-peer-to-peer/#lp2p-data-channel) is inspired by the RTCDataChannel API. This API caters to simple message passing use-cases and developer familiar with WebRTC. The API design augments that of the WebRTC RTCDataChannel API. The [LP2PQuicTransport API](<](https://wicg.github.io/local-peer-to-peer/#lp2p-quic-transport)>) design is inspired by the WebTransport API. This API is designed for use-cases where more direct control over the underlying transport is preferred.
118
117
119
118
## Shorthand APIs
120
119
@@ -140,15 +139,15 @@ _Note_: the shorthand APIs are a work in progress. They are illustrative and wil
140
139
141
140
## Local HTTPS
142
141
143
-
The Local Peer-to-Peer API's authentication process establishes mutual TLS certificates between peers on the local network. These certificates can serve as a trust anchor to validate certificates used by HTTPS servers on the local network.
142
+
The Local Peer-to-Peer API's authentication process establishes mutual TLS certificates between peers on a [local communication medium](https://wicg.github.io/local-peer-to-peer/#local-communication-medium). These certificates can serve as a trust anchor to validate certificates used by HTTPS servers on the local communication medium.
144
143
145
144
Please refer to [Local HTTPS](https://wicg.github.io/local-peer-to-peer/#local-https) in the specification for more details.
146
145
147
146
_Note_: Local HTTPS is a work in progress, see [#34](https://github.com/WICG/local-peer-to-peer/issues/34).
148
147
149
148
## Peer discovery
150
149
151
-
Before any connection can be established, two peers on the local network must find each other. This is done using the `LP2PReceiver` and `LP2PRequest` interfaces:
150
+
Before any connection can be established, two peers on the local communication medium must find each other. This is done using the `LP2PReceiver` and `LP2PRequest` interfaces:
152
151
153
152
```js
154
153
// Peer A
@@ -240,17 +239,17 @@ The Local Peer-to-Peer API has been designed specifically with security and priv
240
239
241
240
## Considered Alternatives
242
241
243
-
When a user wants to connect between two devices on the same network, for example to another device nearby—be it another device the user owns or that of a friend—the user has multiple ways to accomplish this task:
242
+
When a user wants to connect between two devices on the same local communication medium, for example to another device nearby—be it another device the user owns or that of a friend—the user has multiple ways to accomplish this task:
244
243
245
244
1._A cloud service_. The web has many ways of connections to a third-party cloud service: HTTP, WebSocket or WebTransport. However, all of these methods require a round trip through the internet. This is inherently dependant on external resources, it consumes network bandwidth and can be slow or costly and has privacy implications in all but the strongest E2E encryption schemes.
246
245
247
246
2._A local server_. Many modern Web security measures rely on the presence of naming, signaling and certificate authorities. Local use-cases where these authorities are not readily available have started lagging behind in user experience or are not supported altogether. A local solution involves knowing IPs, ports and accepting/ignoring a plethora of "Not secure" warnings to get going. This falls short of the user-friendliness that one can expect of—nowadays ubiquitous—cloud services.
248
247
249
248
3._A WebRTC connection_. While WebRTC is a P2P protocol, it still requires a setup step usually referred to as 'signaling'. There is no good way to perform this step without relying on an existing connection between peers, commonly a cloud service is used.
250
249
251
-
None of these solutions to this seemingly common task provide a compelling user experience. When the devices are physically nearby the user's expectation is the connection process should be as seamless as any physical interaction. With close-range communication technologies widely supported on today's devices we believe this user experience can be vastly improved.
250
+
None of these solutions to this seemingly common task provide a compelling user experience. When the devices share a local communication medium the user's expectation is the connection process should be as seamless as any physical interaction. With a variety of [local communication](https://wicg.github.io/local-peer-to-peer/#local-communication) technologies widely supported on today's devices we believe this user experience can be vastly improved.
252
251
253
-
We need an optimized network path to use a local network connected by the devices for web applications.
252
+
This illustrates the gap for an optimized path for [local communication](https://wicg.github.io/local-peer-to-peer/#local-communication) by web applications.
254
253
255
254

256
255
@@ -266,7 +265,7 @@ Certain use cases can benefit from an internet-based P2P fallback if local commu
266
265
267
266
A number of efforts exist in this area including the [TCP and UDP Socket API](https://www.w3.org/TR/tcp-udp-sockets/), [Discovery API](https://www.w3.org/TR/discovery-api/) and [FlyWeb](https://flyweb.github.io/).
268
267
269
-
The Local Peer-to-Peer approach differs from previous work by putting the user-agent in control during device discovery and mutual authentication. This approach allows exposing bare minimal information about the device to an origin. The list of discovered devices is never shared with the origin and individual peer descriptors such as nickname are only shared with the origin after authentication and user consent. No network information such as IP addresses is ever shared with an origin.
268
+
The Local Peer-to-Peer approach differs from previous work by putting the user-agent in control during device discovery and mutual authentication. This approach allows exposing bare minimal information about the device to an origin. The list of discovered devices is never shared with the origin and individual peer descriptors such as nickname are only shared with the origin after authentication and user consent. No [communication medium topology](https://wicg.github.io/local-peer-to-peer/#communication-medium-topology) information such as IP addresses is ever shared with an origin.
270
269
271
270
The following works are seen as precedent and guide the design of the Local Peer-to-Peer API: [Open Screen Protocol](https://www.w3.org/TR/openscreenprotocol/), [Presentation API](https://www.w3.org/TR/presentation-api/), [Remote Playback API](https://www.w3.org/TR/remote-playback/)[WebRTC](https://www.w3.org/TR/webrtc/), [ORTC (draft)](https://draft.ortc.org/), [WebTransport](https://www.w3.org/TR/webtransport/), [P2P WebTransport (draft)](https://w3c.github.io/p2p-webtransport/).
0 commit comments