Ecosistema: Librerías & Servidores — Solar Net Hub

own · recuperado 2026-09-18 (direct) · original · md
Citado en: 2040039649607852520

★ ~2.000 paquetes npm mencionan "webrtc" · La mayoría son wrappers de browser · Las opciones backend-only viables son pocas ★

§1.6.1 — Librerías WebRTC para Node.js (sin navegador)

LibreríaTipodl/semLicenciaEstadoDCMediaNotas clave
node-datachannelBinding C++ (libdatachannel)42.5kMPL 2.0✅ Activo (v0.32)~8 MB binario. WS integrado. Polyfill RTCPeerConnection.
weriftImplementación pura TS27.2kMIT✅ Activo (v0.22)100% TypeScript. Sin binarios. Simulcast recv, BWE sender.
mediasoupSFU (Node + workers C++)20.3kISC✅ Activo (v3.19)SFU de producción. Multi-stream, simulcast, SVC. 6.4 MB.
livekit-server-sdkSDK para LiveKit (Go)365kApache 2.0✅ Activo (v2.15)SDK Node.js ≠ WebRTC en Node. LiveKit es un server Go aparte.
node-webrtc (wrtc)Binding libwebrtc~2kBSD⚠️ Archivado (2022)Referencia histórica. 80+ MB. Builds rotos Node 18+. No usar.
simple-peerWrapper sobre wrtc/browser~150kMIT⚠️ Bajo mant.En Node depende de wrtc (archivado). En browser funciona bien.
peerjs-serverSolo señalización~10kMIT✅ ActivoNo hace WebRTC — solo coordina SDP entre browsers.

§1.6.2 — Librerías en Otros Lenguajes

Librería / ServidorLenguajeTipoLicenciaDCMediaNotas clave
libdatachannelC/C++Librería~2.7kMPL 2.0Base de node-datachannel. Ligera. Bindings: Rust, Node, Unity, WASM.
Pion/webrtcGoLibrería~14kMITLa referencia Go. go2rtc y MediaMTX están sobre Pion. Pura Go, sin CGO.
go2rtcGo (Pion)Servidor media~7kMITMJPEG, HLS, WebRTC, RTSP. Captura v4l2/ALSA directa. ~15 MB binario.
MediaMTXGo (Pion)Servidor media~13kMITRTSP↔HLS↔WebRTC auto-conv. rpicam nativo (zero-copy CSI).
Janus GatewayCGateway WebRTC~8.5kGPL 3.0SFU/MCU por plugins. Requiere JS en cliente para handshake.
aiortcPythonLibrería~4.5kBSDWebRTC puro Python (asyncio). Útil ML/AI. Python no está en stack SNH.
LiveKitGoSFU completa~22kApache 2.0SFU más popular. TURN integrado. E2EE. SDKs JS/Python/Go/Rust/Swift/Kotlin.

☞ §1.6.3 — Mapa de Decisión

┌─────────────────────────────────────────────────────────────────┐
│             MAPA DE DECISIÓN: WebRTC backend                    │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  ¿Necesitas P2P puro (2 peers)?                                 │
│    → node-datachannel (binding C++, ligero)                     │
│    → werift (TypeScript puro, sin compilar, portable)           │
│                                                                 │
│  ¿Necesitas SFU (muchos peers, rooms)?                          │
│    → mediasoup (SFU embebida en Node.js)                        │
│    → LiveKit (servidor Go aparte, cloud-ready)                  │
│                                                                 │
│  ¿Necesitas servir media al browser SIN JS?                     │
│    → go2rtc (MJPEG/HLS sin ffmpeg, binario Go)                 │
│    → MediaMTX (rpicam nativo CSI, auto-conversión)              │
│    → µStreamer (MJPEG puro, C, ultra-ligero)                    │
│    → ffmpeg directo → HLS estático (mínimo, sin servidor)       │
│                                                                 │
│  ¿Solo señalización (WebRTC corre en browsers)?                 │
│    → peerjs-server, socket.io, o SSB nativo                     │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

P2P: node-datachannel vs. werift

Criterionode-datachannelwerift
RuntimeC++ nativo (N-API)100% TypeScript
CPU mediaMenor (GC no aplica)Mayor (sujeto a V8 GC)
CompilaciónRequiere prebuild/C++npm install sin compilar
Binario~8 MB addon~3.5 MB (JS/TS)
APIPropia + polyfill RTCHacia API browser (v2.0)
WebSocket✔ cliente + servidor✘ externo
Media tracksCompleta (SRTP)Completa (simulcast recv)
InteropChrome, FirefoxChrome, Firefox, Pion, aiortc
RiesgoSi C++ no compila en ARMSi TS es lento en RPi 1 GB

Ambas son viables para P2P en el SNH. node-datachannel gana en CPU; werift gana en portabilidad.

SFU: mediasoup vs. LiveKit

CriteriomediasoupLiveKit
ArquitecturaSe embebe en Node.jsServidor Go independiente
RAM~50-80 MB>100 MB + Redis
EscalaDecenas de peersMiles (cloud-scale)
SeñalizaciónSignaling-agnosticPropia (rooms, tokens JWT)
TURNExternoIntegrado
SDKs clientemediasoup-client (JS)JS, Python, Go, Rust, Swift…
E2EEVia SFrame✔ Nativo
RPi 3B⚠️ Heavy para 1 GB✘ Inviable

Ambos son overkill para 2 peers P2P. Relevantes si Oasis evoluciona a salas grupales.

Servidores Media: MJPEG/HLS sin JS en Cliente

go2rtcMediaMTXµStreamerffmpeg directo
Salida sin JSMJPEG, HLS, JPEGMJPEG, HLSMJPEG, JPEGHLS (.m3u8 + .ts)
CSI zero-copyVia exec rpicam✔ rpiCamera nativoVia M2M HWVia rpicam-vid pipe
USB directo✔ V4L2Necesita ffmpeg✔ V4L2✔ V4L2
Audio✔ ALSA directo✘ Solo vídeo
RAM~20-40 MB~15-30 MB~5-15 MB~30-60 MB
ConfigYAML simpleYAML extensoCLI flagsComando largo
Tor⚠️ MJPEG/HLS sí⚠️ MJPEG/HLS sí✔ HTTP puro✔ HLS estático
PosterArq. 3Impact specArq. 6Retransmisión

Alternativas Evaluadas para Oasis

OpciónDescripciónVeredicto
JS en clientegetUserMedia + RTCPeerConnection en el navegador✘ Rechazado: "no client-side JS" (mantenedores Oasis)
node-datachannel + ffmpegDataChannels + media vía ffmpeg como captura/decode✔ Stack WebRTC puro: ligero, binarios pequeños, acceso HW
werift + ffmpeg100% TypeScript, sin compilar binarios✔ Viable: más portable, menor rendimiento media
Mumble (audio) + go2rtc (vídeo)Reutilizar murmurd + go2rtc para vídeo✔ Candidata fuerte: cero código audio, Tor-compatible
Mumble (audio) + µStreamer (vídeo)murmurd + µStreamer MJPEG✔ Ultra-ligera: ~10-20 MB total, solo LAN
mediasoup SFUSFU embebida en Node.js⚠️ Overkill para 2 peers. Si evoluciona a salas: reconsiderar.
LiveKitSFU Go + Redis✘ Inviable: >100 MB RAM, diseño cloud-scale, no embebido.
Janus GatewayGateway C con plugins⚠️ Requiere JS en cliente para WebRTC handshake.

Las 2 arquitecturas elegidas combinan caminos: Arq. 3 (Mumble+go2rtc+node-datachannel) y Arq. 6 (Mumble+µStreamer+node-datachannel). Ver Matriz de Decisión.

El Cambio de Paradigma: Transmisión ≠ Consumo

El paradigma Web ≠ paradigma HTML5 (subconjunto). Hay una web HTML/CSS sin JavaScript en cliente. WebRTC debe verse como un paradigma de transmisión / consumo de la transmisión: se usa tecnología estándar para transmitir, pero se disocia en la capa de consumo, actuando como relay.

┌─────────────────────────────┐     ┌─────────────────────────────┐
│   TRANSMISIÓN               │     │   CONSUMO                   │
│                             │     │                             │
│  WebRTC estándar:           │     │  HTML/CSS puro:             │
│  · SDP, ICE, DTLS, SRTP    │     │  · <img src="/mjpeg">       │
│  · DataChannels (SCTP)      │     │  · <video src="/hls">       │
│  · node-datachannel         │     │  · <audio src="/ogg">       │
│  · werift                   │     │  · sin JS en cliente        │
│  · go2rtc / MediaMTX        │     │                             │
│                             │     │  Mumble VoIP:               │
│  Mumble VoIP:               │     │  · gumble → ffmpeg → OGG   │
│  · Opus, TCP fallback       │     │  · <audio src="/audio">     │
│  · OCB-AES128               │     │                             │
└──────────────┬──────────────┘     └─────────────────────────────┘
               │                                ▲
               │  Servidor media               │
               │  (go2rtc / µStreamer /        │
               │   ffmpeg / Oasis proxy)       │
               └───────────────────────────────┘

node-datachannel werift mediasoup LiveKit Pion libdatachannel go2rtc MediaMTX µStreamer Janus aiortc simple-peer

Escrivivir · Scriptorium Skins · Animus Iocandi · Aleph Cero · F.A.R.O. · Material transmedia para agentes del juego ARG · AIGPL · Repositorio