UNPKG

@mothepro/fancy-p2p

Version:

A quick and efficient way to form p2p groups in the browser

39 lines 1.5 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.stuns = exports.signaling = void 0; const lit_html_1 = require("lit-html"); const package_json_1 = __importDefault(require("../package.json")); // Can't destruct JSON due to shimmer require("lit-log"); require("./p2p.js"); const params = new URLSearchParams(location.search), isProd = location.protocol == 'https:'; /** Address to the signaling server. */ exports.signaling = isProd ? 'wss://ws.parkshade.com:443' : 'ws://localhost:12345'; /** List of STUN servers to broker P2P connections. */ exports.stuns = [ "stun:stun.stunprotocol.org", "stun:stun.l.google.com:19302", "stun:stun1.l.google.com:19302", "stun:stun2.l.google.com:19302", "stun:stun3.l.google.com:19302", "stun:stun4.l.google.com:19302", ]; // Add `lit-p2p` element with the attributes if user has a name. // The attributes will usually be hardcoded into your app. if (params.has('name')) lit_html_1.render(lit_html_1.html ` <lit-p2p fallback name=${params.get('name')} retries=1 timeout=5000 version=0.3.2 server=${exports.signaling} lobby=${`${package_json_1.default.name}@${package_json_1.default.version}`} .stuns=${exports.stuns} ></lit-p2p>`, document.getElementById('main')); //# sourceMappingURL=index.js.map