[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-111999":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":23,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":15,"starSnapshotCount":15,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},111999,"like-webrtc","LuKks\u002Flike-webrtc","LuKks","Peer-to-peer WebRTC connections with built-in signaling and peer discovery.","https:\u002F\u002Fweb.leet.ar",null,"JavaScript",100,5,70,0,3,10,44.83,"MIT License",false,"main",[],"2026-11-08 01:21:54","2026-11-18 16:42:40","# like-webrtc\n\nPeer-to-peer WebRTC connections with built-in signaling and peer discovery.\n\nWorks across browsers, Node.js, and React Native.\n\n[![npm](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Flike-webrtc.svg)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Flike-webrtc)\n[![downloads](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fdt\u002Flike-webrtc.svg)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Flike-webrtc)\n[![license](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002FLuKks\u002Flike-webrtc.svg)](https:\u002F\u002Fgithub.com\u002FLuKks\u002Flike-webrtc\u002Fblob\u002Fmain\u002FLICENSE)\n[![CI](https:\u002F\u002Fgithub.com\u002FLuKks\u002Flike-webrtc\u002Factions\u002Fworkflows\u002Ftest-node.yml\u002Fbadge.svg?branch=main)](https:\u002F\u002Fgithub.com\u002FLuKks\u002Flike-webrtc\u002Factions\u002Fworkflows\u002Ftest-node.yml)\n\n```\nnpm i like-webrtc\n```\n\n- **P2P servers.** Listen for peer connections anywhere, even in the browser.\n- **Direct connections.** Connect to peers across devices and networks.\n- **Built-in signaling.** Automatic SDP\u002FICE exchange and negotiation.\n- **Identities.** Shareable cryptographic addresses instead of IP addresses.\n- **Peer discovery.** Announce and find peers using shared topics.\n- **WebRTC API.** Use data channels, audio\u002Fvideo tracks and transceivers.\n- **Ready to use.** Signaling, STUN and TURN configured by default.\n\nLive demo: https:\u002F\u002Fweb.leet.ar (P2P Discord clone built in 48 hours)\n\nNeed support with WebRTC? Open a GitHub issue :)\n\n## Usage\n\n#### Direct peer-to-peer connections\n\nA peer can create a server listening on a public key as address.\n\nAnother peer can use that address to connect to the server.\n\n```js\nimport RTC from 'like-webrtc'\n\nconst rtc = new RTC()\n\nconst server = rtc.createServer(peer => {\n  const channel = peer.createDataChannel('wire', { negotiated: true, id: 0 })\n\n  channel.addEventListener('open', () => channel.send('Hello from the server'))\n  channel.addEventListener('message', e => console.log('Server received:', e.data))\n})\n\nconst keyPair = RTC.keyPair()\n\nawait server.listen(keyPair)\n```\n\n```js\nconst rtc2 = new RTC()\n\nconst peer = rtc2.connect(server.publicKey)\n\nconst channel = peer.createDataChannel('wire', { negotiated: true, id: 0 })\n\nchannel.addEventListener('open', () => channel.send('Hello from the client'))\nchannel.addEventListener('message', e => console.log('Client received:', e.data))\n```\n\nA familiar API like Node.js `http`, but peer-to-peer and running directly in your browser.\n\n#### Group peers\n\n\u003Cdetails>\n\u003Csummary>Click to see example\u003C\u002Fsummary>\n\nPeers can create servers with random key pairs.\n\nYou can announce or lookup any server under the same shared topic.\n\n```js\nimport RTC from 'like-webrtc'\n\nconst rtc = new RTC()\n\nconst server = rtc.createServer(peer => {\n  console.log('New peer connection')\n  \u002F\u002F ...\n})\n\nawait server.listen()\nawait server.announce('random-group')\n```\n\n```js\nconst rtc2 = new RTC()\n\nconst results = await rtc2.lookup('random-group')\n\nconst peer = rtc2.connect(results[0].publicKey)\n\u002F\u002F ...\n```\n\u003C\u002Fdetails>\n\n#### Swarm peers\n\n\u003Cdetails>\n\u003Csummary>Click to see example\u003C\u002Fsummary>\n\nEach peer runs the same code to join the swarm.\n\nOther peers will find you.\n\n```js\nimport RTC from 'like-webrtc'\n\nconst rtc = new RTC()\n\nconst server = rtc.createServer(peer => {\n  console.log('New swarm connection')\n  \u002F\u002F ...\n})\n\nawait server.listen()\nawait server.join('random-swarm')\n```\n\u003C\u002Fdetails>\n\n## SIGNALING\n\nSingle signaling server:\n\n- `wss:\u002F\u002Fparty.leet.ar:41337`\n\nIt's a WebSocket server with a RPC protocol.\n\n- E2E noise encryption: meaning HTTPS\u002FWSS is redundant.\n- Announce \u002F Unannounce: act as a server e.g. listen\u002Fclose.\n- Lookup: act as a client by finding peers.\n- Relay: bidirectional data for WebRTC SDP\u002FICE\u002FACK.\n\n## ICE\n\n3 STUN servers:\n\n- `stun:turn.leet.ar:3478`\n- `stun:stun.l.google.com:19302`\n- `stun:stun.cloudflare.com:3478`\n\n1 TURN server with multiple transports:\n\n- `turn:turn.leet.ar:3478?transport=udp`\n- `turn:turn.leet.ar:3478?transport=tcp`\n\n## API\n\n### `rtc = new RTC([options])`\n\nCreates a WebRTC instance.\n\nOptions:\n\n```js\n{\n  signaling, \u002F\u002F Defaults to 'wss:\u002F\u002Fparty.leet.ar:41337'.\n  keyPair, \u002F\u002F Defaults to a key pair generated from seed or random bytes.\n  seed, \u002F\u002F Seed used to generate the key pair.\n  iceServers, \u002F\u002F Defaults to the package's STUN and TURN servers.\n  iceTransportPolicy, \u002F\u002F Defaults to 'all'.\n  trickle, \u002F\u002F Defaults to true.\n  RTCPeerConnection, \u002F\u002F Optional WebRTC implementation override.\n  RTCIceCandidate \u002F\u002F Optional ICE candidate implementation override.\n}\n```\n\n### `peer = rtc.connect(publicKey[, options])`\n\nCreates a P2P connection and returns a `RTCPeerConnection`.\n\nAdd a data channel, track, or transceiver to begin WebRTC negotiation.\n\nOptions:\n\n```js\n{\n  keyPair \u002F\u002F Defaults to rtc.keyPair.\n}\n```\n\n#### `peer.isInitiator`\n\nIdentifies the client (`true`) or server (`false`) side.\n\n#### `peer.publicKey`\n\nThe local public key used for this connection as a buffer.\n\n#### `peer.address`\n\nThe local public key used for this connection as a Base58 string.\n\n#### `peer.remotePublicKey`\n\nThe remote peer's public key as a buffer.\n\n### `server = rtc.createServer([options][, handler])`\n\nCreates a P2P server that accepts WebRTC connections.\n\nThe handler receives each incoming peer connection.\n\nOptions:\n\n```js\n{\n  keyPair, \u002F\u002F Defaults to rtc.keyPair.\n  firewall \u002F\u002F Function or array of allowed public keys. Allows all peers by default.\n}\n```\n\n#### `server.on('connection', peer)`\n\nEmitted on each incoming `RTCPeerConnection`, same as the handler.\n\n#### `server.publicKey`\n\nReturns the server's public key as a buffer.\n\n#### `server.address`\n\nReturns the server's public key as a Base58 string.\n\n#### `await server.listen([keyPair])`\n\nStarts listening for connections under the server's public key so peers can connect.\n\n#### `await server.announce(topic)`\n\nAnnounces the listening server under `topic` and refreshes the announcement while the server listens.\n\nThe server removes the announcement when it closes.\n\n#### `await server.unannounce(topic)`\n\nRemoves the server's announcement for `topic`.\n\nThe server keeps listening for direct connections.\n\nIf the server has joined `topic`, it will keep looking up peers.\n\nThe `topic` stays unannounced until you call `server.announce(topic)` or leave and join again.\n\n#### `await server.join(topic)`\n\nFinds peers that announce `topic` and connects to them.\n\nIf the server is listening, it also announces itself under that topic.\n\nThe server emits a `connection` event for each discovered connection.\n\nClosed connections are retried after 1 second, 5 seconds, 15 seconds, then every 10 minutes.\n\n#### `await server.leave(topic)`\n\nStops finding peers under `topic`.\n\nIf only `server.join(topic)` announced the `topic`, it also removes that announcement.\n\nAn announcement made from `server.announce(topic)` stays active.\n\nExisting peer connections stay open.\n\nCancels retries unless the peer was also discovered under another joined topic.\n\n#### `await server.close()`\n\nCloses the server's peer connections, removes its topic announcements, and closes its signaling connection.\n\n### `await rtc.announce(topic[, options])`\n\nSigns and sends the announcement with `keyPair`.\n\nOptions:\n\n```js\n{\n  keyPair \u002F\u002F Defaults to rtc.keyPair.\n}\n```\n\nThe announcement expires unless you refresh or remove it.\n\n### `await rtc.unannounce(topic[, options])`\n\nSigns and sends a request to remove the announcement with `keyPair`.\n\nOptions:\n\n```js\n{\n  keyPair \u002F\u002F Defaults to rtc.keyPair.\n}\n```\n\n### `peers = await rtc.lookup(topic)`\n\nReturns peers announced under `topic`:\n\n```js\n[\n  { publicKey }\n]\n```\n\nAn announcement can remain even after a peer abruptly disconnects, unless closed properly.\n\nThe peer can stay discoverable while reconnecting after a brief signaling drop or page refresh.\n\nA lookup during this gap can return a peer that is still offline.\n\n#### `await rtc.close()`\n\nCloses the RTC instance, its servers, its peers, and its signaling.\n\nIf you called `rtc.announce()` directly, call `rtc.unannounce()` to remove those announcements.\n\nIf you do not remove these manual announcements, they remain available until expiration.\n\n#### `keyPair = RTC.keyPair([seed])`\n\nCreates a key pair. Pass `seed` to create the same key pair each time.\n\n#### `bytes = RTC.randomBytes(size)`\n\nReturns random bytes.\n\n#### `stream = RTC.WebStream(dataChannelOrWebSocket)`\n\nWraps a WebRTC data channel or a WebSocket in a duplex stream.\n\nUseful for interacting with common Node.js streams.\n\n## Ideas\n\nWhatsApp relays and stores messages for 30d if the recipient is offline.\n\nTelegram uses WebRTC with double encryption to avoid trusting SRTP\u002FDTLS.\n\nDiscord forwards WebRTC media with SFUs so peers don't connect together.\n\n`like-webrtc` can do the same for a perfect P2P experience including the browser.\n\n- RPC relay messages must be E2E encrypted between peers to avoid learning from connections or metadata\n- Create a tiny SFU topology from scratch using WebRTC e.g. 3 people speaking and 3000 listening\n- Signaling could be a HTTPS server with EventSource\u002FSSE instead of a WebSocket server\n- Make deploying TURN servers easy so people can use their own and allow app creators to pay for bandwidth\n- Payments is outside of the scope of this module but it's important for peers to be able to exchange value\n- More cryptographic safety around verifying announcement signatures locally\n- WebRTC-HTTP ingestion protocol (WHIP instead of RTMP?)\n- WebRTC-HTTP egress protocol (WHEP instead of HLS\u002FCDN?)\n- Reusable module for WebRTC audio, video, screen, etc so that creating frontend apps is easy\n- HTTPS server that helps connect to a WebRTC signaling peer to avoid TCP\u002FHTTPS\u002FWebSocket traffic\n\n## License\n\nMIT. Copyright (c) Lucas Barrena\n","like-webrtc 是一个简化 WebRTC 点对点通信的 JavaScript 库，提供内置信令、对等方发现和加密身份管理。核心功能包括跨浏览器\u002FNode.js\u002FReact Native 的 P2P 连接、自动 SDP\u002FICE 协商、基于公钥的可共享地址、基于主题的对等方广播与查找，以及兼容标准 WebRTC API 的数据通道与媒体能力。默认集成 STUN\u002FTURN，开箱即用。适用于构建去中心化实时应用，如轻量级聊天、协作工具、P2P 文件共享或边缘协同系统，尤其适合需快速实现可靠端到端连接而无需自建信令服务器的场景。",2,"2026-11-24 04:42:02","CREATED_QUERY"]