reticulum-js
    Preparing search index...

    Module @reticulum/webrtc-node

    @reticulum/webrtc-node — Node.js WebRTC support for the zero-dependency, browser-safe @reticulum/core core.

    Node.js has no native RTCPeerConnection. The core's WebRTCSignaling (in @reticulum/core) is dependency-injection-first: it accepts a createPeerConnection factory and only falls back to the browser global. This package supplies that factory, backed by werift, closing the loop for Node:

    import { WebRTCSignaling } from "@reticulum/core";
    import { createPeerConnection } from "@reticulum/webrtc-node";

    const signaling = new WebRTCSignaling({ rns, createPeerConnection });

    @reticulum/webrtc-node

    Node.js WebRTC support for @reticulum/core, backed by werift.

    Node.js has no native RTCPeerConnection. The @reticulum/core core's WebRTC transport signaling (WebRTCSignaling) is dependency-injection-first: it accepts a createPeerConnection factory and only falls back to the browser global when one is omitted. In a browser that just works; in Node you need to supply a factory. This package supplies one, backed by werift — a pure-JavaScript WebRTC implementation with no native/C++ build (important for Termux/Android dev).

    npm install @reticulum/webrtc-node
    

    This depends on @reticulum/core and werift automatically.

    Pass createPeerConnection to WebRTCSignaling (or anywhere the core expects the factory):

    import { Reticulum, WebRTCSignaling } from "@reticulum/core";
    import { createPeerConnection } from "@reticulum/webrtc-node";

    const rns = new Reticulum();
    // ...add at least one transport interface so signaling can reach peers...

    const signaling = new WebRTCSignaling({
    rns,
    createPeerConnection,
    // rtcConfig: { iceServers: [{ urls: "stun:stun.l.google.com:19302" }] },
    });
    await signaling.start();

    Once signaling opens a data channel with a peer, it wraps it in a WebRTCInterface and registers it with the transport as a high-bandwidth direct link. See the WebRTC Transport document for the cross-language wire format.

    Export Description
    createPeerConnection(config) Factory returning a werift RTCPeerConnection, duck-compatible with the shape the core expects
    RTCPeerConnection Re-exported werift class

    Licensed under the EUPL 1.2. See the monorepo README for project-wide information.

    RTCPeerConnection
    createPeerConnection