Analysis of WebRTC signaling (2021)
Web Real-Time-Communications (WebRTC) is a modern open framework that allows peer-to-peer (P2P) communication. It is currently the only mechanism that a web browser has to perform P2P connections; mostly used for video and audio calls, but can be used to communicate any arbitrary data. Other popular use cases include: P2P chat, real time videogames and file sharing. As on any P2P system, a mechanism must exist that allows bootstrapping the P2P connection (making the two peers aware of their address:port, NAT hole-punching, etc.). Two examples are bittorrent trackers, and the bootstrap nodes hard-coded in Bitcoin's full-node software. In the WebRTC framework, this process is called signaling, it allows one peer's connection offer to be shared with a responding second peer, which then replies with a connection answer that must be relayed back to the first peer. This signaling must be performed through a bi-directional transport (e.g. polling, websockets). In this thesis we propose Multti, a new no-delay transport similar to WebSockets that is both less resource consuming and more scalable. Multti uses the browser Fetch API to send data from the client, and uses an EventSource stream to receive Server-Sent Events (SSE) immediately. Harnessing the reusability of HTTP/2 sockets, a browser may open multiple streams and perform multiple HTTP POSTs using only one socket. Multiple experiments were performed with varying configurations such as concurrency, number of peers, and number of browser processes while measuring server's memory consumption and TCP sockets. Results show that the proposal consumes both less memory and less sockets in most scenarios. While using HTTP/1 is possible with the proposed implementation, the benefits would be lost. To conclude, a new client and server WebRTC signaling implementation is proposed using Fetch and SSE on top of HTTP/2, that consumes less resources and is more scalable receiving data. Future work on Multti would focus on making it multi-threaded and generic, to allow not only WebRTC signaling, but any bi-directional communication to happen.