Re:A look at asm.js and the future with WebAssembly
by Matthias247 on Saturday January 16, 2016 @06:57AM
(#10915064)
But this would require the remote peer to utilize the same protocol encapsulation (UDP->SCTP->UDP), wouldn't it? This means due to browser limitations you can never directly speek an existing UDP/TCP protocol besides HTTP/WS.
This is because there is a WebRTC data channel you can use that uses SCTP. Emscripten emulates UDP on top of SCTP (which should be just a few bytes overhead per packet). Emscripten also includes the excellent enet networking library which let's you multiplex multiple reliable and unreliable channels on the same connection.
It's kind of a crazy multi-level hack (enet->UDP->SCTP->UDP->C++->JavaScript) but it works well.