Robust, minimal-server-interaction peer routing in the browser
npm install @elijah-bodden/membrane

Robust, minimal-server-interaction peer routing in the browser
Membrane leverages the RTCPeerConnection API's agnosticism regarding signaling. You could just as well communicate ICE connectivity data through smoke signals or quantum teleportation (if only), as through a conventional signalling server. That's profound; we forced to use this terribly unreliable, centralized approach. With membrane, just one server-based signal opens an entire realm of peers; each membrane is a single, behemoth router. Distant, unconnected members can exchange arbitrary data in milliseconds, with no clumsy intermediary server, nor any risk of downtime.
To be clear, however, this approach is not perfect. The boon of decentralization may in fact be this project's worst enemy. No singular, trusted ledger to authenticate peers means spoofing, posing, and general manipulation are elementary.
In brief, this tool is robustly functional at enabling anonymous, homogeneous, untrusted data exchange across a network, but poor at most else.
npmnpxnode.js shell
curl -LJo Membrane-current.tar.gz https://github.com/Elijah-Bodden/Membrane/tarball/v1.0.5
tar xfv Membrane-current.tar.gz --transform 's!^[^/]\+\($\|/\)!Membrane-current\1!'
cd Membrane-current/src/source/frontend
npm install
cd ../server
npm install
npm run deploy
rm ../../../../Membrane-current.tar.gz
`
To kill the pm2 daemon created by npm run deploy, run npm run kill.
However, although this demo functions, this does not mean it should be used in production. It is a quick-and-dirty demonstration of the library's promise, and is not made for any serious scalable production situation. quoting ./src/source/frontend's "PLEASENOTE.md",
>Excluding the included lib code, the vast majority of the code within this directory and its descendants should never see the light of serious production. It was hastily coded to fit its closed use case. This is nothing more than a demo of the library—far out-of-scope of this project's goal. Please do not treat it as a true part of Membrane. The project begins and ends at lib.
TL;DR: This code is a great risk to the performance and stability of your frontend. Unlike lib, it was not intended as a viable product, and shouldn't be used like one.
$3
Installing the pre-made server from /src/source/server/index.noStatic.js is a piece of cake! Simply enter the following into a terminal while in the root of your node project, sit back, and relax while the project installs.
`bash
npm i membrane-server
`
Then, to deploy the server over pm2 onto websocket port 8777, enter npm explore membrane-server -- npm run deploy. Simmilarly, to kill the instance created by this command, run npm explore membrane-server -- npm run kill. Now just remember to replace the signalling addresses in your lib script's config with your new server's, and you're ready to go.
$3
Using the vanilla lib module in a custom use-case is relatively simple. Here is an overview of the typical integration process. First, find the delivery method you like below, then, after you've completed its unique instructions, head down below to the general next steps
| Delivery Vector | Instructions |
---- | ----
| npm + Webpack | Run npm install @elijah-bodden/membrane \| cd node-modules/elijah-bodden/membrane in the root of your webpack project[ \[1\]](#f1)|
| HTML script tag | Enter your project's static file directory, find where you'd like to store the script, then run wget https://raw.githubusercontent.com/Elijah-Bodden/Membrane/main/lib/index.js -o membrane.min.js. Then insert within your HTML head the following tag: . From here, return to the folder where you installed the script and follow the instructions found after this table |
| Jsdelivr CDN (not recommended) | With this method, you will not need to follow the general instruction which come after the table; however, you will be stuck with the default config and every peer request will be accepted by default. If you wish to proceed, knowing this, simply prepend the following tag to your HTML head's contents.