Skip to content

Enhance WebRTC Pvt-to-Pvt example by WebRTC Direct SDP Exchange via QR Code #210

@Nkovaturient

Description

@Nkovaturient

Description [Discussed here- #208 ]

This proposal aims to enable browser-to-browser WebRTC connections without a relay server, allowing users to establish private, offline, peer-to-peer communication. The SDP exchange happens via QR codes instead of a centralized signaling server, making it ideal for censorship-heavy regions, offline scenarios, or restricted networks (e.g., Bluetooth-based networks). The proposal can enhance libp2p and IPFS use cases by enabling peer discovery and direct communication when traditional internet-based methods fail.


How It Works

  1. Browser A (Initiator)

    • Generates an SDP offer using WebRTC APIs.
    • Optionally gathers ICE candidates (STUN helps but is not mandatory).
    • Encodes the SDP offer as a QR Code (or a sharable text file).
  2. Browser B (Receiver)

    • Scans the QR code (or manually imports the SDP file).
    • Creates an SDP answer based on the received offer.
    • Encodes its SDP answer as another QR Code (or shares it manually).
    • Both browsers exchange ICE candidates manually if needed.
  3. Establishing Connection

    • Once both browsers have exchanged SDP offers/answers & ICE candidates, WebRTC establishes a direct P2P connection.
    • The connection is now independent of the initial exchange method.

Features

  • Decentralized WebRTC Connection: No signaling server or relay node required.
  • Offline Communication: Works without WiFi, internet, or public relays.
  • QR Code-based SDP Exchange: Secure and simple method for peer-to-peer connection setup.
  • Manual ICE Candidate Exchange: Enables direct connections even in NAT-restricted environments.
  • Bluetooth/NFC Support (Future Scope): Enhance SDP exchange for truly offline networking.
  • Improved Privacy: No third-party server involvement.
  • libp2p/IPFS Compatibility: Can be integrated with libp2p for ad-hoc network formation.

Challenges

  • NAT Traversal Issues: If both peers are behind a strict NAT, connection may fail without a TURN server.
  • Manual ICE Candidate Exchange: Some setups may require multiple QR code scans.
  • QR Code Size Limitations: Long SDPs may require text-based exchange instead.
  • Limited Browser Bluetooth API: Current Web Bluetooth APIs may not support large SDP exchanges.
  • User Experience Considerations: Multiple scans or manual text pasting may affect usability.

Advantages

No relay servers → Works in censorship-heavy areas.
Offline-first → Works in areas with no internet.
No central authority → Ensures privacy & security.
Supports Bluetooth/NFC → Expands connectivity options.
Can integrate with libp2p → Enables decentralized peer discovery.


Next Steps

  • Implementing a proof-of-concept WebRTC QR Code exchange demo.
  • Exploring Bluetooth API/NFC for local SDP transfer.
  • Investigating libp2p integration for identity & multi-hop networking.

Relevant Links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions