I am proposing the removal of the experimental -sSOCKET_WEBRTC setting along with its vendored third-party dependencies (third_party/socket.io.js and third_party/wrtcp.js).
Background & Current Status:
• -sSOCKET_WEBRTC=1 was added to Emscripten in 2013 (commit 4fb9a41) as an alternative POSIX
sockets backend (libsockfs.js) to route connections over WebRTC data channels via an intermediate
signaling broker (WebSocketBroker).
• It relies on two vendored JavaScript libraries in third_party/:
• third_party/socket.io.js: Version 0.9.11 of socket.io-client from 2012.
• third_party/wrtcp.js: An experimental WebRTC P2P broker (wrtcp) written by Alan Kligman at
Mozilla in 2012–2013.
• The setting has long been marked in src/settings.js as: // Select socket backend, either webrtc
or websockets. XXX webrtc is not currently tested, may be broken.
Reasons for Removal:
- No Test Coverage or Maintenance: There are no tests in Emscripten's test suite (test/)
exercising -sSOCKET_WEBRTC=1, wrtcp.js, or socket.io.js.
- Obsolete Third-Party Code: socket.io.js v0.9.11 uses the legacy v1 wire protocol. Upgrading
socket.io.js to modern Socket.IO v4+ would require rewriting wrtcp.js from scratch due to breaking
changes in Engine.IO and connection event signatures.
- Outdated WebRTC APIs & Hardcoded IP: wrtcp.js relies on deprecated callback-based WebRTC SDP
methods, checks vendor-prefixed constructors (mozRTCPeerConnection, webkitRTCPeerConnection), and
hardcodes a legacy STUN server IP address (stun:23.21.150.121).
- Better Alternatives Available: For non-blocking sockets, Emscripten actively supports standard
WebSocket emulation (-sWEBSOCKET_URL), native proxying (-sPROXY_POSIX_SOCKETS=1), and direct
node:net sockets (-sNODERAWSOCKETS=1).
- Codebase Cleanup: Deleting these two vendored files removes ~4,690 lines of unmaintained
JavaScript from the repository.
Proposed Action:
• Move SOCKET_WEBRTC to LEGACY_SETTINGS (['SOCKET_WEBRTC', [0], 'No longer supported']) so -
sSOCKET_WEBRTC=0 continues to be accepted for backwards compatibility while -sSOCKET_WEBRTC=1
errors.
• Remove third_party/socket.io.js and third_party/wrtcp.js.
• Remove all #if SOCKET_WEBRTC branches from src/lib/libcore.js and src/lib/libsockfs.js.
If anyone is currently relying on SOCKET_WEBRTC in an active project or has concerns about its
removal, please comment below!
I am proposing the removal of the experimental -sSOCKET_WEBRTC setting along with its vendored third-party dependencies (third_party/socket.io.js and third_party/wrtcp.js).
Background & Current Status:
• -sSOCKET_WEBRTC=1 was added to Emscripten in 2013 (commit 4fb9a41) as an alternative POSIX
sockets backend (libsockfs.js) to route connections over WebRTC data channels via an intermediate
signaling broker (WebSocketBroker).
• It relies on two vendored JavaScript libraries in third_party/:
• third_party/socket.io.js: Version 0.9.11 of socket.io-client from 2012.
• third_party/wrtcp.js: An experimental WebRTC P2P broker (wrtcp) written by Alan Kligman at
Mozilla in 2012–2013.
• The setting has long been marked in src/settings.js as: // Select socket backend, either webrtc
or websockets. XXX webrtc is not currently tested, may be broken.
Reasons for Removal:
exercising -sSOCKET_WEBRTC=1, wrtcp.js, or socket.io.js.
socket.io.js to modern Socket.IO v4+ would require rewriting wrtcp.js from scratch due to breaking
changes in Engine.IO and connection event signatures.
methods, checks vendor-prefixed constructors (mozRTCPeerConnection, webkitRTCPeerConnection), and
hardcodes a legacy STUN server IP address (stun:23.21.150.121).
WebSocket emulation (-sWEBSOCKET_URL), native proxying (-sPROXY_POSIX_SOCKETS=1), and direct
node:net sockets (-sNODERAWSOCKETS=1).
JavaScript from the repository.
Proposed Action:
• Move SOCKET_WEBRTC to LEGACY_SETTINGS (['SOCKET_WEBRTC', [0], 'No longer supported']) so -
sSOCKET_WEBRTC=0 continues to be accepted for backwards compatibility while -sSOCKET_WEBRTC=1
errors.
• Remove third_party/socket.io.js and third_party/wrtcp.js.
• Remove all #if SOCKET_WEBRTC branches from src/lib/libcore.js and src/lib/libsockfs.js.
If anyone is currently relying on SOCKET_WEBRTC in an active project or has concerns about its
removal, please comment below!