Description
title: Local peer discovery, to enable local WebRTC connections
date: 2020-12-07T22:28:17.424Z
submitter: PRIVATE
number: 5fceac811b340e1de0f630d3
tags: [ ]
discussion: https://github.com/WebWeWant/webwewant.fyi/discussions/
status: [ discussing || in-progress || complete ]
related:
- title:
url:
type: [ article || explainer || draft || spec || note || discussion ]
This would be an enhancement to the Channel Messaging API.
Browsers could prompt the user to select a remote browser to connect to. Once chosen, the receiving browser would prompt their user to accept the connection. If agreed, a MessageChannel would be established between the two browsers.
The web pages on each end could then communicate over the ports of the channel. If they wished, they could use these ports as a signalling channel to further create WebRTC connections.
The method that the browsers use to establish the MessageChannel can be a simple TCP connection, or perhaps even a PeerConnection itself. The underlying method is not visible to the web application.
Essentially, we're looking for the same flow that Chromecast currently uses. A user tries to cast content. The browser prompts for which device to connect to. Once chosen, a channel is opened and data can be sent/received. The Chromecast is given a web page URL to load, which can then further set up communication if it chooses. In this proposal, when the receiving user accepts the connection, it is expected that the communication would be sent to the target URL, a new tab would be opened if necessary, or they could choose a different registered URL based on the protocol configured by the sending user.
In other words, if both users have a chat application open (let's call it "SuperChat") and User A tries to connect to User B, User A's connection request will contain a protocol identifier (called "chat-proto"), as well as a URL (https://superchat.example.com/). User B will receive the request, and since they already have https://superchat.example.com/ open, an event will be fired on that page, and it will receive the new port. If the page wasn't already open, a new tab with that page will be opened. Alternatively, User B may have configured their own preferred "chat-proto" handler (perhaps, "UltraChat"), and the URL for UltraChat will be used in this same flow instead.
While the local peer discovery is most important to my immediate use case, it also makes sense that the browser could connect to other peers. Perhaps registered users of Google Chrome may want to connect to other folks on their contact list who are online. In effect, the browsers call each other, and then pass the phone off to the other web application to do all the communicating. It doesn't matter how the browsers "call" each other... whether that's a local network, a friend list, or anything else the browser implementers come up with.
This proposal simplifies several use cases for communication. If I want to connect two computers in the same room, I currently have to establish connectivity through a WebRTC signalling server, send some initial information via e-mail or message, connect, and then eventually get connected locally. This is excessive infrastructure, and prone to failure when there is unreliable internet access. Also, it doesn't enable passive peer discovery. For example, suppose I'm on an plane and want to play a game with someone over a shared network, but there is no internet access. If users want to enable themselves to be discoverable, they should be able to do that.
There is no good workaround today for this problem. At best, a browser extension can enable some of this capability, but it isn't a good solution and not exactly cross-platform.
Brad Isbell
[email protected]
If posted, this will appear at https://webwewant.fyi/wants/5fceac811b340e1de0f630d3/
Activity