{"id":14483592,"url":"https://github.com/libp2p/js-libp2p-webrtc","last_synced_at":"2025-12-30T15:18:51.744Z","repository":{"id":50376448,"uuid":"518907740","full_name":"libp2p/js-libp2p-webrtc","owner":"libp2p","description":null,"archived":true,"fork":false,"pushed_at":"2023-06-16T15:42:54.000Z","size":686,"stargazers_count":38,"open_issues_count":2,"forks_count":16,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-08-19T10:02:45.355Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libp2p.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-28T15:52:30.000Z","updated_at":"2025-04-13T22:00:11.000Z","dependencies_parsed_at":"2024-06-21T18:43:52.566Z","dependency_job_id":"c2e2f87b-cd8e-4469-978f-f475801876bf","html_url":"https://github.com/libp2p/js-libp2p-webrtc","commit_stats":{"total_commits":189,"total_committers":22,"mean_commits":8.590909090909092,"dds":0.8095238095238095,"last_synced_commit":"de9671447b6e8a200175a5da6407d42cf2c736e4"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/libp2p/js-libp2p-webrtc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-webrtc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-webrtc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-webrtc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-webrtc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libp2p","download_url":"https://codeload.github.com/libp2p/js-libp2p-webrtc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-webrtc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272805349,"owners_count":24995909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-03T00:01:53.576Z","updated_at":"2025-12-15T01:14:45.907Z","avatar_url":"https://github.com/libp2p.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# 📁 Archived - this module has been merged into [js-libp2p](https://github.com/libp2p/js-libp2p/tree/master/packages/transport-webrtc)\n\n# @libp2p/webrtc \u003c!-- omit in toc --\u003e\n\n[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)\n[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)\n[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-webrtc.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-webrtc)\n[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-webrtc/js-test-and-release.yml?branch=main\\\u0026style=flat-square)](https://github.com/libp2p/js-libp2p-webrtc/actions/workflows/js-test-and-release.yml?query=branch%3Amain)\n\n\u003e A libp2p transport using WebRTC connections\n\n## Table of contents \u003c!-- omit in toc --\u003e\n\n- [Install](#install)\n  - [Browser `\u003cscript\u003e` tag](#browser-script-tag)\n- [Usage](#usage)\n- [Examples](#examples)\n- [Interfaces](#interfaces)\n  - [Transport](#transport)\n  - [Connection](#connection)\n- [Development](#development)\n  - [Build](#build)\n  - [Protocol Buffers](#protocol-buffers)\n  - [Test](#test)\n  - [Lint](#lint)\n  - [Clean](#clean)\n  - [Check Dependencies](#check-dependencies)\n- [License](#license)\n- [Contribution](#contribution)\n\n## Install\n\n```console\n$ npm i @libp2p/webrtc\n```\n\n### Browser `\u003cscript\u003e` tag\n\nLoading this module through a script tag will make it's exports available as `Libp2pWebrtc` in the global namespace.\n\n```html\n\u003cscript src=\"https://unpkg.com/@libp2p/webrtc/dist/index.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n```js\nimport { createLibp2p } from 'libp2p'\nimport { noise } from '@chainsafe/libp2p-noise'\nimport { multiaddr } from '@multiformats/multiaddr'\nimport first from 'it-first'\nimport { pipe } from 'it-pipe'\nimport { fromString, toString } from 'uint8arrays'\nimport { webRTC } from '@libp2p/webrtc'\n\nconst node = await createLibp2p({\n  transports: [webRTC()],\n  connectionEncryption: [noise()],\n});\n\nawait node.start()\n\nconst ma =  multiaddr('/ip4/0.0.0.0/udp/56093/webrtc/certhash/uEiByaEfNSLBexWBNFZy_QB1vAKEj7JAXDizRs4_SnTflsQ')\nconst stream = await node.dialProtocol(ma, ['/my-protocol/1.0.0'])\nconst message = `Hello js-libp2p-webrtc\\n`\nconst response = await pipe([fromString(message)], stream, async (source) =\u003e await first(source))\nconst responseDecoded = toString(response.slice(0, response.length))\n```\n\n## Examples\n\nExamples can be found in the [examples folder](examples/README.md).\n\n## Interfaces\n\n### Transport\n\n![https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/interface-transport](https://raw.githubusercontent.com/libp2p/js-libp2p-interfaces/master/packages/interface-transport/img/badge.png)\n\nBrowsers can usually only `dial`, but `listen` is supported in the WebRTC\ntransport when paired with another listener like CircuitV2, where you listen on\na relayed connection. Take a look at [index.js](examples/browser-to-browser/index.js) for\nan example.\n\n### Connection\n\n![https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/interface-connection](https://raw.githubusercontent.com/libp2p/js-libp2p-interfaces/master/packages/interface-connection/img/badge.png)\n\n```js\ninterface MultiaddrConnection extends Duplex\u003cUint8Array\u003e {\n  close: (err?: Error) =\u003e Promise\u003cvoid\u003e\n  remoteAddr: Multiaddr\n  timeline: MultiaddrConnectionTimeline\n}\n\nclass WebRTCMultiaddrConnection implements MultiaddrConnection { }\n```\n\n## Development\n\nContributions are welcome! The libp2p implementation in JavaScript is a work in progress. As such, there's a few things you can do right now to help out:\n\n- [Check out the existing issues](//github.com/little-bear-labs/js-libp2p-webrtc/issues).\n- **Perform code reviews**.\n- **Add tests**. There can never be enough tests.\n- Go through the modules and **check out existing issues**. This is especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically.\n\nPlease be aware that all interactions related to libp2p are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nSmall note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\nThis module leans heavily on (Aegir)\\[\u003chttps://github.com/ipfs/aegir\u003e] for most of the `package.json` scripts.\n\n### Build\n\nThe build script is a wrapper to `aegir build`.  To build this package:\n\n```shell\nnpm run build\n```\n\nThe build will be located in the `/dist` folder.\n\n### Protocol Buffers\n\nThere is also `npm run generate:proto` script that uses protoc to populate the generated code directory `proto_ts` based on `*.proto` files in src. Don't forget to run this step before `build` any time you make a change to any of the `*.proto` files.\n\n### Test\n\nTo run all tests:\n\n```shell\nnpm test\n```\n\nTo run tests for Chrome only:\n\n```shell\nnpm run test:chrome\n```\n\nTo run tests for Firefox only:\n\n```shell\nnpm run test:firefox\n```\n\n### Lint\n\nAegir is also used to lint the code, which follows the [Standard](https://github.com/standard/standard) JS linter.\nThe VS Code plugin for this standard is located at \u003chttps://marketplace.visualstudio.com/items?itemName=standard.vscode-standard\u003e.\nTo lint this repo:\n\n```shell\nnpm run lint\n```\n\nYou can also auto-fix when applicable:\n\n```shell\nnpm run lint:fix\n```\n\n### Clean\n\n```shell\nnpm run clean\n```\n\n### Check Dependencies\n\n```shell\nnpm run deps-check\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / \u003chttp://opensource.org/licenses/MIT\u003e)\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibp2p%2Fjs-libp2p-webrtc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibp2p%2Fjs-libp2p-webrtc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibp2p%2Fjs-libp2p-webrtc/lists"}