WICG / local-peer-to-peer

↔️ Proposal for local communication between browsers without the aid of a server.
https://wicg.github.io/local-peer-to-peer/
Other
62 stars 6 forks source link

Supporting different payload types (String, Blob, ArrayBuffer) #13

Closed backkem closed 7 months ago

backkem commented 9 months ago

The explainer currently says:

await peerB.send("Hello from peer A!"); // or Blob or ArrayBuffer

I wanted to highlight the protocol impact of supporting both String, Blob and ArrayBuffer here. If we want the same type to be returned at the other side of the connection, this payload type needs to be communicated. This means the underlying protocol needs to support it. As an example, WebRTC DataChannels do this by 'sneaking' the payload type in the 'SCTP Payload Protocol Identifier' as defined here.

I didn't check if other protocols like QUIC have a good/common way of 'sneaking' this information outside/alongside the main data stream. If not, it may be preferable to specify a lightweight framing protocol that can be tunneled over any underlying binary stream.

This is somewhat related to #11 as the WebTransport API only deals in binary data.

backkem commented 7 months ago

Considered closed by #23.