Mozilla and Humble Bundle have teamed up to release HumbleNet, a C API that wraps WebRTC and WebSockets and hides away all the platform differences between browser and non-browser platforms.
Starting as a project in 2015 to support an initiative to port peer-to-peer multiplayer games in asm.js and WebAssembly, Mozilla identified the need for UDP networking support for web games and partnered with Humble Bundle to release the project as open source.
But why does the world need another networking library? According to Mozilla:
When the idea of HumbleNet first emerged we knew we could use WebSocketsto enable multiplayer gaming on the web. This approach would require us to either replace the entire protocol with WebSockets (the approach taken by the asm.js port of Quake 3), or to tunnel UDP traffic through a WebSocket connection to talk to a UDP-based server at a central location.
In order to work, both approaches require a middleman to handle all network traffic between all clients. WebSockets is good for games that require a reliable ordered communication channel, but real-time games require a lower latency solution. And most real-time games care more about receiving the most recent data than getting ALL of the data in order. WebRTC’s UDP-based data channel fills this need perfectly. HumbleNet provides an easy-to-use API wrapper around WebRTC that enables real-time UDP connections between clients using the WebRTC data channel.
You can find pre-built redistributables at https://humblenet.github.io/ with binaries for Linux, macOS, Windows, a C# wrapper, Unity3D plugin, and emscripten for targeting asm.js or WebAssembly.
Learn more from Mozilla's announcement by clicking here.