21st IEEE International Symposium on Network Computing and Applications (NCA 2022)

WebDHT:

browser-compatible distributed hash table for decentralized Web applications

https://nca2022.rossilorenzo.dev/

Lorenzo Rossi (lorenzo@rossilorenzo.dev)
Luca Ferretti (luca.ferretti@unimore.it)
University of Modena and Reggio Emilia
General problem:

Web applications are migrating complex logic from server to browser code.

Some applications do not depend on a backend server.

One of the most challenging requirements is enabling efficient communications among users' browsers

(for instance: multiplayer games, telephony applications, live document editing)

Issue: Peer discovery in
Web applications

How to exchange packets between browsers?

Relay server:

WebRTC channel:

Opening a WebRTC connection

Usually the signaling channel is a centralized server

Caller Callee Signaling channel Offer Answer WebRTC connection open WebRTC connection Offer Answer

Message forwarding
through referral browser

WebDHT is a decentralized peer discovery service, each browser in the DHT can be an intermediary to forward signaling messages between other nodes.

But who do we connect with?

Distributed Hash Table (DHT)

HashTable distributed on multiple computers, very popular in native peer-to-peer applications. Also defines a routing protocol to efficiently connect to other nodes.

Used by:

  • BitTorrent
  • IPFS (File sharing)
  • Jami (Video conferencing)
WebDHT

DHT compatible with browsers to distribute load

Main features:
  • DHT compatible with connection-oriented protocols (WebRTC)
  • Logic-part is modular over the used transport
  • Developed in Rust
  • Compilable to WebAssembly

The same code can be used both in a high-performance server and in the browser

Related work

  • Projects already used WebRTC as a signaling protocol (https://github.com/unsetbit/p)
  • Others have analyzed other distributed routing protocols, but did not account for the signaling server load [1]
  • WebDHT is the first working implementation of a DHT integrating WebRTC that takes into consideration server load

[1] "An adaptive peer-sampling protocol for building networks of browsers" Brice Nédelec et al, WWW 2021

Differences with Kademlia

Modifications are needed due to constraints of browser environments and of Web protocols:

  • While the routing protocol remains unchanged, WebDHT has adapted it to work with connection-oriented protocols (specifically, WebRTC).
  • Browsers support a low-number of WebRTC connections
  • Routing data structures have been extended with connection pools to distinguish permanent and ephemeral connections and avoid saturating browsers resources

WebDHT Handshake

with channel binding to protect against MitM

Project structure

Demo applications

WebDHT Chat

wdhtchat.rossilorenzo.dev

Simple chat to demonstrate thow an application can easily use WebDHT as a peer-discovery mechanism.

TorrentParty

tparty.rossilorenzo.dev

More complex application to watch videos in sync between a group of people, it also supports screen sharing. (video: Spring Open Movie by Blender)

Limits and future work

  • Some NAT and firewall configurations might impede peer-to-peer WebRTC connections
  • When a page is not visible to the user, the browsers put the page in an "hibernation" state, blocking or slowing down the node's function
  • WebDHT uses WebRTC even for native-to-native node connections, a more lightweight protocol might be used

Thanks for your attention!

Questions?

You can find the source code on:
github.com/SnowyCoder/wdht