{"id":14483603,"url":"https://github.com/libp2p/js-libp2p-websockets","last_synced_at":"2025-08-30T04:31:37.692Z","repository":{"id":4279150,"uuid":"52522469","full_name":"libp2p/js-libp2p-websockets","owner":"libp2p","description":"WebSockets module that libp2p uses and that implements the interface-transport spec ","archived":true,"fork":false,"pushed_at":"2023-07-21T15:50:51.000Z","size":1584,"stargazers_count":95,"open_issues_count":4,"forks_count":46,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-12-10T05:57:11.410Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://libp2p.io","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":"2016-02-25T12:21:14.000Z","updated_at":"2024-01-12T18:07:25.000Z","dependencies_parsed_at":"2024-06-18T12:41:30.337Z","dependency_job_id":"622cf8a2-9029-408d-9bac-1e7f6a1fe711","html_url":"https://github.com/libp2p/js-libp2p-websockets","commit_stats":{"total_commits":309,"total_committers":35,"mean_commits":8.82857142857143,"dds":0.6763754045307444,"last_synced_commit":"3645c2ba72ff1fd0b2a3f385f3cefa5e182f27ff"},"previous_names":[],"tags_count":91,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-websockets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-websockets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-websockets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-websockets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libp2p","download_url":"https://codeload.github.com/libp2p/js-libp2p-websockets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231443791,"owners_count":18377602,"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","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:54.085Z","updated_at":"2024-12-27T05:30:24.962Z","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-websockets)\n\n# @libp2p/websockets \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-websockets.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-websockets)\n[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-websockets/js-test-and-release.yml?branch=master\\\u0026style=flat-square)](https://github.com/libp2p/js-libp2p-websockets/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)\n\n\u003e JavaScript implementation of the WebSockets module that libp2p uses and that implements the interface-transport spec\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  - [Constructor properties](#constructor-properties)\n- [Libp2p Usage Example](#libp2p-usage-example)\n- [API](#api)\n  - [Transport](#transport)\n  - [Connection](#connection)\n- [API Docs](#api-docs)\n- [License](#license)\n- [Contribution](#contribution)\n\n## Install\n\n```console\n$ npm i @libp2p/websockets\n```\n\n### Browser `\u003cscript\u003e` tag\n\nLoading this module through a script tag will make it's exports available as `Libp2pWebsockets` in the global namespace.\n\n```html\n\u003cscript src=\"https://unpkg.com/@libp2p/websockets/dist/index.min.js\"\u003e\u003c/script\u003e\n```\n\n[![](https://raw.githubusercontent.com/libp2p/interface-transport/master/img/badge.png)](https://github.com/libp2p/interface-transport)\n[![](https://raw.githubusercontent.com/libp2p/interface-connection/master/img/badge.png)](https://github.com/libp2p/interface-connection)\n\n## Usage\n\n```sh\n\u003e npm i @libp2p/websockets\n```\n\n### Constructor properties\n\n```js\nimport { createLibp2pNode } from 'libp2p'\nimport { webSockets } from '@libp2p/webrtc-direct'\n\nconst node = await createLibp2p({\n  transports: [\n    webSockets()\n  ]\n  //... other config\n})\nawait node.start()\nawait node.dial('/ip4/127.0.0.1/tcp/9090/ws')\n```\n\n| Name     | Type                                                                                                                       | Description                                                            | Default                                                                  |\n| -------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------------------------------ |\n| upgrader | [`Upgrader`](https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-interfaces/src/transport#upgrader) | connection upgrader object with `upgradeOutbound` and `upgradeInbound` | **REQUIRED**                                                             |\n| filter   | `(multiaddrs: Array\u003cMultiaddr\u003e) =\u003e Array\u003cMultiaddr\u003e`                                                                       | override transport addresses filter                                    | **Browser:** DNS+WSS multiaddrs / **Node.js:** DNS+\\[WS, WSS] multiaddrs |\n\nYou can create your own address filters for this transports, or rely in the filters [provided](./src/filters.js).\n\nThe available filters are:\n\n- `filters.all`\n  - Returns all TCP and DNS based addresses, both with `ws` or `wss`.\n- `filters.dnsWss`\n  - Returns all DNS based addresses with `wss`.\n- `filters.dnsWsOrWss`\n  - Returns all DNS based addresses, both with `ws` or `wss`.\n\n## Libp2p Usage Example\n\n```js\nimport { createLibp2pNode } from 'libp2p'\nimport { websockets } from '@libp2p/websockets'\nimport filters from '@libp2p/websockets/filters'\nimport { mplex } from '@libp2p/mplex'\nimport { noise } from '@libp2p/noise'\n\nconst transportKey = Websockets.prototype[Symbol.toStringTag]\nconst node = await Libp2p.create({\n  transport: [\n    websockets({\n      // connect to all sockets, even insecure ones\n      filters: filters.all\n    })\n  ],\n  streamMuxers: [\n    mplex()\n  ],\n  connectionEncryption: [\n    noise()\n  ]\n})\n```\n\nFor more information see [libp2p/js-libp2p/doc/CONFIGURATION.md#customizing-transports](https://github.com/libp2p/js-libp2p/blob/master/doc/CONFIGURATION.md#customizing-transports).\n\n## API\n\n### Transport\n\n[![](https://raw.githubusercontent.com/libp2p/interface-transport/master/img/badge.png)](https://github.com/libp2p/interface-transport)\n\n### Connection\n\n[![](https://raw.githubusercontent.com/libp2p/interface-connection/master/img/badge.png)](https://github.com/libp2p/interface-connection)\n\n## API Docs\n\n- \u003chttps://libp2p.github.io/js-libp2p-websockets\u003e\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-websockets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibp2p%2Fjs-libp2p-websockets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibp2p%2Fjs-libp2p-websockets/lists"}